init repo
This commit is contained in:
42
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.cpp
Normal file
42
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "DocxFile2.h"
|
||||
|
||||
|
||||
[ module(dll, uuid = "{A1EEE61A-FAA7-47af-B078-4E955623B9CA}",
|
||||
name = "ASCOfficeDocxFile2",
|
||||
helpstring = "ASCOfficeDocxFile2 1.0 Type Library",
|
||||
resource_name = "IDR_ASCOFFICEDOCXFILE2") ];
|
||||
147
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.rc
Normal file
147
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.rc
Normal file
@@ -0,0 +1,147 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
#define COMPONENT_NAME "OfficeDocxFile2"
|
||||
#include "../Common/FileInfo.h"
|
||||
#include "version.h"
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Russian resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
|
||||
#pragma code_page(1251)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Russian resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "InternalName", COMPONENT_FILE_NAME_DLL
|
||||
VALUE "LegalCopyright", LEGAL_COPYRIGHT
|
||||
VALUE "OriginalFilename", COMPONENT_FILE_NAME_DLL
|
||||
VALUE "ProductName", FILE_DESCRIPTION_ACTIVEX
|
||||
VALUE "ProductVersion", STRVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// REGISTRY
|
||||
//
|
||||
|
||||
IDR_ASCOFFICEDOCXFILE2 REGISTRY "ASCOfficeDocxFile2.rgs"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_PROJNAME "ASCOfficeDocxFile2"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
IDB_DEFAULT_DOC_RELS DOCXWR "Resources\\.rels"
|
||||
IDB_DEFAULT_DOC_APP DOCXWR "Resources\\app.xml"
|
||||
IDB_DEFAULT_DOC_CORE DOCXWR "Resources\\core.xml"
|
||||
IDB_DEFAULT_DOC_THEME DOCXWR "Resources\\theme.xml"
|
||||
IDB_DEFAULT_DOC_WEBSETTINGS DOCXWR "Resources\\webSettings.xml"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
11
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.rgs
Normal file
11
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.rgs
Normal file
@@ -0,0 +1,11 @@
|
||||
HKCR
|
||||
{
|
||||
NoRemove AppID
|
||||
{
|
||||
'%APPID%' = s 'ASCOfficeDocxFile2'
|
||||
'ASCOfficeDocxFile2.DLL'
|
||||
{
|
||||
val AppID = s '%APPID%'
|
||||
}
|
||||
}
|
||||
}
|
||||
41
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.sln
Normal file
41
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.sln
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeDocxFile2", "ASCOfficeDocxFile2.vcproj", "{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
|
||||
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
|
||||
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release|Win32.Build.0 = Release|Win32
|
||||
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
|
||||
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
|
||||
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
|
||||
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.Build.0 = Release|Win32
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.ActiveCfg = Release|Win32
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.Build.0 = Release|Win32
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
|
||||
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
660
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.vcproj
Normal file
660
ActiveX/ASCOfficeDocxFile2/ASCOfficeDocxFile2.vcproj
Normal file
@@ -0,0 +1,660 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="ASCOfficeDocxFile2"
|
||||
ProjectGUID="{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}"
|
||||
RootNamespace="ASCOfficeDocxFile2"
|
||||
Keyword="AtlProj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
UseOfATL="1"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="false"
|
||||
TargetEnvironment="1"
|
||||
GenerateStublessProxies="true"
|
||||
TypeLibraryName="$(IntDir)/ASCOfficeDocxFile2.tlb"
|
||||
HeaderFileName="DocxFile2.h"
|
||||
DLLDataFileName=""
|
||||
InterfaceIdentifierFileName="ASCOfficeDocxFile2_i.c"
|
||||
ProxyFileName="ASCOfficeDocxFile2_p.c"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Zm1000"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/XML/include";"$(SolutionDir)";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects/Font/FreeType";"$(SolutionDir)/../Common/DocxFormat/Source/DocxFormat""
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS;SOLUTION_ASCOFFICEDOCXFILE2"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1049"
|
||||
AdditionalIncludeDirectories="$(IntDir)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="true"
|
||||
AdditionalDependencies="comsvcs.lib comsuppw.lib gdiplus.lib DocxFormat.lib"
|
||||
OutputFile="$(OutDir)/ASCOfficeDocxFile2.dll"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/win_build/Release";"$(SolutionDir)/../Common/DocxFormat/Lib/Debug""
|
||||
IgnoreDefaultLibraryNames="LIBC.lib"
|
||||
MergedIDLBaseFileName="_ASCOfficeDocxFile2.idl"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/ASCOfficeDocxFile2.lib"
|
||||
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"
|
||||
Description="Performing registration"
|
||||
CommandLine="regsvr32 /s /c "$(TargetPath)""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
UseOfATL="1"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
CommandLine=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="false"
|
||||
TargetEnvironment="1"
|
||||
GenerateStublessProxies="true"
|
||||
TypeLibraryName="$(IntDir)/ASCOfficeDocxFile2.tlb"
|
||||
HeaderFileName="DocxFile2.h"
|
||||
DLLDataFileName=""
|
||||
InterfaceIdentifierFileName="ASCOfficeDocxFile2_i.c"
|
||||
ProxyFileName="ASCOfficeDocxFile2_p.c"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Zm1000"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/XML/include";"$(SolutionDir)";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects/Font/FreeType";"$(SolutionDir)/../Common/DocxFormat/Source/DocxFormat""
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS;SOLUTION_ASCOFFICEDOCXFILE2"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1049"
|
||||
AdditionalIncludeDirectories="$(IntDir)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="true"
|
||||
AdditionalDependencies="comsvcs.lib comsuppw.lib gdiplus.lib DocxFormat.lib"
|
||||
OutputFile="$(OutDir)/$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/win_build/Release";"$(SolutionDir)/../Common/DocxFormat/Lib/Release""
|
||||
IgnoreDefaultLibraryNames="LIBC.lib"
|
||||
MergedIDLBaseFileName="_ASCOfficeDocxFile2.idl"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/ASCOfficeDocxFile2.lib"
|
||||
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"
|
||||
Description="Performing registration"
|
||||
CommandLine="regsvr32 /s /c "$(TargetPath)"
copy "$(TargetPath)" "$(SolutionDir)..\Redist"
"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="ReleaseASC|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
UseOfATL="1"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
CommandLine=""
|
||||
ExcludedFromBuild="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="false"
|
||||
TargetEnvironment="1"
|
||||
GenerateStublessProxies="true"
|
||||
TypeLibraryName="$(IntDir)/ASCOfficeDocxFile2.tlb"
|
||||
HeaderFileName="DocxFile2.h"
|
||||
DLLDataFileName=""
|
||||
InterfaceIdentifierFileName="ASCOfficeDocxFile2_i.c"
|
||||
ProxyFileName="ASCOfficeDocxFile2_p.c"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Zm1000"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects/Font/FreeType";"$(SolutionDir)/../Common/DocxFormat/Source/DocxFormat""
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS;SOLUTION_ASCOFFICEDOCXFILE2"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG;ASCBUILD"
|
||||
Culture="1049"
|
||||
AdditionalIncludeDirectories="$(IntDir)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="true"
|
||||
AdditionalDependencies="comsvcs.lib comsuppw.lib gdiplus.lib DocxFormat.lib"
|
||||
OutputFile="$(OutDir)/ASCOfficeDocxFile2.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="$(SolutionDir)/../Common/DocxFormat/Lib/Release"
|
||||
IgnoreDefaultLibraryNames="LIBC.lib"
|
||||
MergedIDLBaseFileName="_ASCOfficeDocxFile2.idl"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/ASCOfficeDocxFile2.lib"
|
||||
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"
|
||||
Description="Performing registration"
|
||||
CommandLine="regsvr32 /s /c "$(TargetPath)"
copy "$(TargetPath)" "$(SolutionDir)..\..\..\..\ASC\Redist\ASCOfficeStudio"
"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="ReleaseOpenSource|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
UseOfATL="1"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
CommandLine=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="false"
|
||||
TargetEnvironment="1"
|
||||
GenerateStublessProxies="true"
|
||||
TypeLibraryName="$(IntDir)/ASCOfficeDocxFile2.tlb"
|
||||
HeaderFileName="DocxFile2.h"
|
||||
DLLDataFileName=""
|
||||
InterfaceIdentifierFileName="ASCOfficeDocxFile2_i.c"
|
||||
ProxyFileName="ASCOfficeDocxFile2_p.c"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Zm1000"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/XML/include";"$(SolutionDir)";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects/Font/FreeType";"$(SolutionDir)/../Common/DocxFormat/Source/DocxFormat""
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS;SOLUTION_ASCOFFICEDOCXFILE2;BUILD_CONFIG_OPENSOURCE_VERSION"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1049"
|
||||
AdditionalIncludeDirectories="$(IntDir)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="true"
|
||||
AdditionalDependencies="comsvcs.lib comsuppw.lib gdiplus.lib"
|
||||
OutputFile="$(OutDir)/$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/win_build/Release";"$(SolutionDir)/../Common/DocxFormat/Lib/$(ConfigurationName)""
|
||||
IgnoreDefaultLibraryNames="LIBC.lib"
|
||||
MergedIDLBaseFileName="_ASCOfficeDocxFile2.idl"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/ASCOfficeDocxFile2.lib"
|
||||
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"
|
||||
Description="copy to RedistOpenSource"
|
||||
CommandLine="copy "$(TargetPath)" "$(SolutionDir)..\Redist"
"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="res"
|
||||
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}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ASCOfficeDocxFile2.rc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ASCOfficeDocxFile2.rgs"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="_"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ASCOfficeDocxFile2.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="ReleaseASC|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="ReleaseOpenSource|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
ObjectFile="$(IntDir)\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
ObjectFile="$(IntDir)\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="ReleaseASC|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
ObjectFile="$(IntDir)\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="ReleaseOpenSource|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
ObjectFile="$(IntDir)\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\version.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="DocWrapper"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\DocWrapper\FontProcessor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DocWrapper\FontProcessor.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Foreign"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Foreign\StringWriter.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="BinWiter"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\TeamlabOffice\trunk\XlsxSerializerCom\Reader\BinaryWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinWriter\BinReaderWriterDefines.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinWriter\BinWriters.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinWriter\StreamUtils.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="BinReader"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\BinReader\Common.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\FileDownloader.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Reader"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\TeamlabOffice\trunk\XlsxSerializerCom\Writer\BinaryReader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\ReaderClasses.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\Readers.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Writer"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\BinReader\ChartWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\CommentsWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\ContentTypesWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\DocumentRelsWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\DocumentWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\FileWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\fontTableWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\HeaderFooterWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\MediaWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\NumberingWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\SettingWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinReader\StylesWriter.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\DocxFile2.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
109
ActiveX/ASCOfficeDocxFile2/BinReader/ChartWriter.h
Normal file
109
ActiveX/ASCOfficeDocxFile2/BinReader/ChartWriter.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Common.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
class ChartWriter
|
||||
{
|
||||
class ChartElem
|
||||
{
|
||||
public:
|
||||
CString content;
|
||||
CString filename;
|
||||
int index;
|
||||
};
|
||||
CSimpleArray<ChartElem*> m_aCharts;
|
||||
CString m_sDir;
|
||||
ContentTypesWriter& m_oContentTypesWriter;
|
||||
int nChartCount;
|
||||
public:
|
||||
ChartWriter(CString sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
|
||||
{
|
||||
nChartCount = 0;
|
||||
}
|
||||
~ChartWriter()
|
||||
{
|
||||
for(int i = 0, length = m_aCharts.GetSize(); i < length; ++i)
|
||||
{
|
||||
delete m_aCharts[i];
|
||||
}
|
||||
}
|
||||
bool IsEmpty()
|
||||
{
|
||||
return 0 == m_aCharts.GetSize();
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
if(false == IsEmpty())
|
||||
{
|
||||
CString sChartDir = m_sDir + _T("/word/charts");
|
||||
CreateDirectory(sChartDir, NULL);
|
||||
for(int i = 0, length = m_aCharts.GetSize(); i < length; ++i)
|
||||
{
|
||||
ChartElem* elem = m_aCharts[i];
|
||||
CString sRelPath = _T("/word/charts/") + elem->filename;
|
||||
CString sAbsPath = m_sDir + sRelPath;
|
||||
|
||||
CFile oFile;
|
||||
oFile.CreateFile(sAbsPath);
|
||||
oFile.WriteStringUTF8(elem->content);
|
||||
oFile.CloseFile();
|
||||
|
||||
|
||||
m_oContentTypesWriter.AddOverride(sRelPath, CString(_T("application/vnd.openxmlformats-officedocument.drawingml.chart+xml")));
|
||||
}
|
||||
}
|
||||
}
|
||||
void AddChart(CString& content, CString& sRelsName, int& index)
|
||||
{
|
||||
ChartElem* pChartElem = new ChartElem();
|
||||
pChartElem->content = content;
|
||||
pChartElem->index = nChartCount + 1;
|
||||
nChartCount++;
|
||||
pChartElem->filename.Format(_T("chart%d.xml"), pChartElem->index);
|
||||
sRelsName = _T("charts/") + pChartElem->filename;
|
||||
index = pChartElem->index;
|
||||
|
||||
m_aCharts.Add(pChartElem);
|
||||
}
|
||||
int getChartCount()
|
||||
{
|
||||
return nChartCount;
|
||||
}
|
||||
void setChartCount(int val)
|
||||
{
|
||||
nChartCount = val;
|
||||
}
|
||||
};
|
||||
}
|
||||
105
ActiveX/ASCOfficeDocxFile2/BinReader/CommentsWriter.h
Normal file
105
ActiveX/ASCOfficeDocxFile2/BinReader/CommentsWriter.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Common.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
static CString g_string_comment_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:comments xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static CString g_string_comment_End = _T("</w:comments>");
|
||||
static CString g_string_commentExt_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w15:commentsEx xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static CString g_string_commentExt_End = _T("</w15:commentsEx>");
|
||||
static CString g_string_people_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w15:people xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static CString g_string_people_End = _T("</w15:people>");
|
||||
|
||||
class CommentsWriter
|
||||
{
|
||||
CString m_sDir;
|
||||
ContentTypesWriter& m_oContentTypesWriter;
|
||||
public:
|
||||
CString m_sComment;
|
||||
CString m_sCommentExt;
|
||||
CString m_sPeople;
|
||||
public:
|
||||
CommentsWriter(CString sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
|
||||
{
|
||||
}
|
||||
void setElements(CString& sComment, CString& sCommentExt, CString& sPeople)
|
||||
{
|
||||
m_sComment = sComment;
|
||||
m_sCommentExt = sCommentExt;
|
||||
m_sPeople = sPeople;
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
if(false == m_sComment.IsEmpty())
|
||||
{
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\word\\comments.xml"));
|
||||
oFile.WriteStringUTF8(g_string_comment_Start);
|
||||
oFile.WriteStringUTF8(m_sComment);
|
||||
oFile.WriteStringUTF8(g_string_comment_End);
|
||||
oFile.CloseFile();
|
||||
|
||||
|
||||
m_oContentTypesWriter.AddOverride(CString(_T("/word/comments.xml")), CString(_T("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml")));
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(false == m_sCommentExt.IsEmpty())
|
||||
{
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\word\\commentsExtended.xml"));
|
||||
oFile.WriteStringUTF8(g_string_commentExt_Start);
|
||||
oFile.WriteStringUTF8(m_sCommentExt);
|
||||
oFile.WriteStringUTF8(g_string_commentExt_End);
|
||||
oFile.CloseFile();
|
||||
|
||||
|
||||
m_oContentTypesWriter.AddOverride(CString(_T("/word/commentsExtended.xml")), CString(_T("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml")));
|
||||
}
|
||||
if(false == m_sPeople.IsEmpty())
|
||||
{
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\word\\people.xml"));
|
||||
oFile.WriteStringUTF8(g_string_people_Start);
|
||||
oFile.WriteStringUTF8(m_sPeople);
|
||||
oFile.WriteStringUTF8(g_string_people_End);
|
||||
oFile.CloseFile();
|
||||
|
||||
|
||||
m_oContentTypesWriter.AddOverride(CString(_T("/word/people.xml")), CString(_T("application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml")));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
124
ActiveX/ASCOfficeDocxFile2/BinReader/Common.h
Normal file
124
ActiveX/ASCOfficeDocxFile2/BinReader/Common.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef BINREADER_COMMON
|
||||
#define BINREADER_COMMON
|
||||
|
||||
#include "FileDownloader.h"
|
||||
#include "../Foreign/StringWriter.h"
|
||||
|
||||
bool IsUnicodeSymbol( WCHAR symbol )
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if ( ( 0x0009 == symbol ) || ( 0x000A == symbol ) || ( 0x000D == symbol ) ||
|
||||
( ( 0x0020 <= symbol ) && ( 0xD7FF >= symbol ) ) || ( ( 0xE000 <= symbol ) && ( symbol <= 0xFFFD ) ) ||
|
||||
( ( 0x10000 <= symbol ) && symbol ) )
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
void CorrectString(CString& strValue)
|
||||
{
|
||||
for (unsigned int i = 0, length = strValue.GetLength(); i < length; ++i )
|
||||
{
|
||||
if ( false == IsUnicodeSymbol( strValue.GetAt(i) ) )
|
||||
{
|
||||
strValue.SetAt(i, ' ');
|
||||
}
|
||||
}
|
||||
strValue.Replace(_T("&"), _T("&"));
|
||||
strValue.Replace(_T("'"), _T("'"));
|
||||
strValue.Replace(_T("<"), _T("<"));
|
||||
strValue.Replace(_T(">"), _T(">"));
|
||||
strValue.Replace(_T("\""), _T("""));
|
||||
}
|
||||
long Round(double val)
|
||||
{
|
||||
return (long)(val+ 0.5);
|
||||
}
|
||||
CString DownloadImage(const CString& strFile)
|
||||
{
|
||||
CFileDownloader oDownloader(strFile, FALSE);
|
||||
oDownloader.Start( 1 );
|
||||
while ( oDownloader.IsRunned() )
|
||||
{
|
||||
::Sleep( 10 );
|
||||
}
|
||||
CString strFileName;
|
||||
if ( oDownloader.IsFileDownloaded() )
|
||||
{
|
||||
strFileName = oDownloader.GetFilePath();
|
||||
}
|
||||
return strFileName;
|
||||
}
|
||||
VOID convertBase64ToImage (CString sImage, CString &pBase64)
|
||||
{
|
||||
HANDLE hFileWriteHandle;
|
||||
|
||||
hFileWriteHandle = ::CreateFile (sImage, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
if (INVALID_HANDLE_VALUE != hFileWriteHandle)
|
||||
{
|
||||
INT nUTF8Len = WideCharToMultiByte (CP_UTF8, 0, pBase64, pBase64.GetLength (), NULL, NULL, NULL, NULL);
|
||||
CHAR *pUTF8String = new CHAR [nUTF8Len + 1];
|
||||
::ZeroMemory (pUTF8String, sizeof (CHAR) * (nUTF8Len + 1));
|
||||
|
||||
WideCharToMultiByte (CP_UTF8, 0, pBase64, -1, pUTF8String, nUTF8Len, NULL, NULL);
|
||||
CStringA sUnicode; sUnicode = pUTF8String;
|
||||
delete[] pUTF8String;
|
||||
|
||||
|
||||
int nShift = 0;
|
||||
int nIndex = sUnicode.Find("base64,");
|
||||
if(-1 != nIndex)
|
||||
{
|
||||
nShift = nIndex + 7;
|
||||
}
|
||||
|
||||
LONG lFileSize = sUnicode.GetLength () - nShift;
|
||||
INT nDstLength = lFileSize;
|
||||
BYTE *pBuffer = new BYTE [lFileSize];
|
||||
::ZeroMemory (pBuffer, lFileSize);
|
||||
Base64::Base64Decode ((LPCSTR)sUnicode.GetBuffer () + nShift, lFileSize, pBuffer, &nDstLength);
|
||||
|
||||
|
||||
DWORD dwBytesWrite = 0;
|
||||
::WriteFile (hFileWriteHandle, pBuffer, nDstLength, &dwBytesWrite, 0);
|
||||
|
||||
RELEASEARRAYOBJECTS (pBuffer);
|
||||
|
||||
CloseHandle (hFileWriteHandle);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
74
ActiveX/ASCOfficeDocxFile2/BinReader/ContentTypesWriter.h
Normal file
74
ActiveX/ASCOfficeDocxFile2/BinReader/ContentTypesWriter.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Common.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
static CString g_string_ct_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">");
|
||||
static CString g_string_ct_Ext = _T("<Default Extension=\"bmp\" ContentType=\"image/bmp\"/><Default Extension=\"jpg\" ContentType=\"image/jpeg\"/><Default Extension=\"jpeg\" ContentType=\"image/jpeg\"/><Default Extension=\"jpe\" ContentType=\"image/jpeg\"/><Default Extension=\"png\" ContentType=\"image/png\"/><Default Extension=\"gif\" ContentType=\"image/gif\"/><Default Extension=\"emf\" ContentType=\"image/x-emf\"/><Default Extension=\"wmf\" ContentType=\"image/x-wmf\"/><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/>");
|
||||
static CString g_string_ct_Override = _T("<Override PartName=\"/word/document.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"/><Override PartName=\"/word/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\"/><Override PartName=\"/word/settings.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml\"/><Override PartName=\"/word/webSettings.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml\"/><Override PartName=\"/word/fontTable.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml\"/><Override PartName=\"/word/theme/theme1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.theme+xml\"/><Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\"/><Override PartName=\"/docProps/app.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\"/>");
|
||||
static CString g_string_ct_End = _T("</Types>");
|
||||
|
||||
class ContentTypesWriter
|
||||
{
|
||||
CStringWriter m_oWriter;
|
||||
CString m_sDir;
|
||||
CStringWriter m_oAdditional;
|
||||
public:
|
||||
ContentTypesWriter(CString sDir):m_sDir(sDir)
|
||||
{
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
m_oWriter.WriteString(g_string_ct_Start);
|
||||
m_oWriter.WriteString(g_string_ct_Ext);
|
||||
m_oWriter.WriteString(g_string_ct_Override);
|
||||
m_oWriter.Write(m_oAdditional);
|
||||
m_oWriter.WriteString(g_string_ct_End);
|
||||
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\[Content_Types].xml"));
|
||||
oFile.WriteStringUTF8(m_oWriter.GetData());
|
||||
oFile.CloseFile();
|
||||
}
|
||||
void AddOverride(CString& PartName, CString& ContentType)
|
||||
{
|
||||
CString sOverride;sOverride.Format(_T("<Override PartName=\"%s\" ContentType=\"%s\"/>"),PartName , ContentType);
|
||||
m_oAdditional.WriteString(sOverride);
|
||||
}
|
||||
void AddOverrideRaw(CString& sXml)
|
||||
{
|
||||
m_oAdditional.WriteString(sXml);
|
||||
}
|
||||
};
|
||||
}
|
||||
93
ActiveX/ASCOfficeDocxFile2/BinReader/DocumentRelsWriter.h
Normal file
93
ActiveX/ASCOfficeDocxFile2/BinReader/DocumentRelsWriter.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Common.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
class DocumentRelsWriter
|
||||
{
|
||||
CStringWriter m_oWriter;
|
||||
CString m_sDir;
|
||||
int m_nRid;
|
||||
CAtlArray<CString> m_aRels;
|
||||
bool bDocumentRels;
|
||||
public:
|
||||
DocumentRelsWriter(CString sDir, bool bDocumentRels, int nRid = 1):m_sDir(sDir),bDocumentRels(bDocumentRels)
|
||||
{
|
||||
m_nRid = nRid;
|
||||
}
|
||||
void Write(CString sFileName)
|
||||
{
|
||||
CString s_dr_Start;
|
||||
CString s_dr_End;
|
||||
if(true == bDocumentRels)
|
||||
{
|
||||
s_dr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/><Relationship Id=\"rId3\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\" Target=\"settings.xml\"/><Relationship Id=\"rId4\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings\" Target=\"webSettings.xml\"/><Relationship Id=\"rId5\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable\" Target=\"fontTable.xml\"/><Relationship Id=\"rId6\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\" Target=\"theme/theme1.xml\"/>");
|
||||
s_dr_End = _T("</Relationships>");
|
||||
}
|
||||
else
|
||||
{
|
||||
s_dr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
|
||||
s_dr_End = _T("</Relationships>");
|
||||
}
|
||||
if(m_nRid > 1)
|
||||
{
|
||||
m_oWriter.WriteString(s_dr_Start);
|
||||
for(int i = 0, length = m_aRels.GetCount(); i < length; ++i)
|
||||
{
|
||||
m_oWriter.WriteString(m_aRels[i]);
|
||||
}
|
||||
m_oWriter.WriteString(s_dr_End);
|
||||
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\word\\_rels\\") + sFileName);
|
||||
oFile.WriteStringUTF8(m_oWriter.GetData());
|
||||
oFile.CloseFile();
|
||||
}
|
||||
}
|
||||
CString AddRels(CString sType, CString sTarget, bool bExternal = false)
|
||||
{
|
||||
CorrectString(sType);
|
||||
CorrectString(sTarget);
|
||||
CString srId;srId.Format(_T("rId%d"), m_nRid);
|
||||
CString sRels;
|
||||
if(bExternal)
|
||||
sRels.Format(_T("<Relationship Id=\"%s\" Type=\"%s\" Target=\"%s\" TargetMode=\"External\"/>"), srId, sType, sTarget);
|
||||
else
|
||||
sRels.Format(_T("<Relationship Id=\"%s\" Type=\"%s\" Target=\"%s\"/>"), srId, sType, sTarget);
|
||||
m_nRid++;
|
||||
m_aRels.Add(sRels);
|
||||
return srId;
|
||||
}
|
||||
};
|
||||
}
|
||||
87
ActiveX/ASCOfficeDocxFile2/BinReader/DocumentWriter.h
Normal file
87
ActiveX/ASCOfficeDocxFile2/BinReader/DocumentWriter.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Common.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
class DocumentWriter : public ContentWriter
|
||||
{
|
||||
CStringWriter m_oWriter;
|
||||
HeaderFooterWriter& m_oHeaderFooterWriter;
|
||||
public:
|
||||
CString m_sDir;
|
||||
public:
|
||||
DocumentWriter(CString sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir), m_oHeaderFooterWriter(oHeaderFooterWriter)
|
||||
{
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\word\\document.xml"));
|
||||
oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\"><w:body>")));
|
||||
oFile.WriteStringUTF8(m_oContent.GetData());
|
||||
oFile.WriteStringUTF8(CString(_T("<w:sectPr >")));
|
||||
oFile.WriteStringUTF8(WriteSectPrHdrFtr());
|
||||
oFile.WriteStringUTF8(m_oSecPr.GetData());
|
||||
oFile.WriteStringUTF8(CString(_T("</w:sectPr>")));
|
||||
oFile.WriteStringUTF8(CString(_T("</w:body></w:document>")));
|
||||
oFile.CloseFile();
|
||||
}
|
||||
CString WriteSectPrHdrFtr()
|
||||
{
|
||||
CString sResult;
|
||||
bool bTitlePage = false;
|
||||
if(!m_oHeaderFooterWriter.m_oHeaderFirst.rId.IsEmpty())
|
||||
{
|
||||
sResult += _T("<w:headerReference w:type=\"first\" r:id=\"") + m_oHeaderFooterWriter.m_oHeaderFirst.rId + _T("\"/>");
|
||||
bTitlePage = true;
|
||||
}
|
||||
if(!m_oHeaderFooterWriter.m_oHeaderEven.rId.IsEmpty())
|
||||
sResult += _T("<w:headerReference w:type=\"even\" r:id=\"") + m_oHeaderFooterWriter.m_oHeaderEven.rId + _T("\"/>");
|
||||
if(!m_oHeaderFooterWriter.m_oHeaderOdd.rId.IsEmpty())
|
||||
sResult += _T("<w:headerReference w:type=\"default\" r:id=\"") + m_oHeaderFooterWriter.m_oHeaderOdd.rId + _T("\"/>");
|
||||
if(!m_oHeaderFooterWriter.m_oFooterFirst.rId.IsEmpty())
|
||||
{
|
||||
sResult += _T("<w:footerReference w:type=\"first\" r:id=\"") + m_oHeaderFooterWriter.m_oFooterFirst.rId + _T("\"/>");
|
||||
bTitlePage = true;
|
||||
}
|
||||
if(!m_oHeaderFooterWriter.m_oFooterEven.rId.IsEmpty())
|
||||
sResult += _T("<w:footerReference w:type=\"even\" r:id=\"") + m_oHeaderFooterWriter.m_oFooterEven.rId + _T("\"/>");
|
||||
if(!m_oHeaderFooterWriter.m_oFooterOdd.rId.IsEmpty())
|
||||
sResult += _T("<w:footerReference w:type=\"default\" r:id=\"") + m_oHeaderFooterWriter.m_oFooterOdd.rId + _T("\"/>");
|
||||
if(true == bTitlePage)
|
||||
sResult += _T("<w:titlePg/>");
|
||||
return sResult;
|
||||
}
|
||||
};
|
||||
}
|
||||
395
ActiveX/ASCOfficeDocxFile2/BinReader/FileDownloader.h
Normal file
395
ActiveX/ASCOfficeDocxFile2/BinReader/FileDownloader.h
Normal file
@@ -0,0 +1,395 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../Common/BaseThread.h"
|
||||
|
||||
#include <wininet.h>
|
||||
#pragma comment(lib, "Wininet")
|
||||
|
||||
|
||||
|
||||
|
||||
#define MAX_SIZE 256
|
||||
|
||||
#define DOWNLOAD_FILE_SIZE 32768
|
||||
#define MAX_SINGLE_DOWNLOAD_FILE_SIZE 524288
|
||||
|
||||
|
||||
|
||||
#define CONTENT_RANGE _T("bytes 0-0/")
|
||||
|
||||
#define CONTENT_RANGE_SIZE ( 11 - 1 )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CFileDownloader : public CBaseThread
|
||||
{
|
||||
public :
|
||||
|
||||
CFileDownloader (CString sFileUrl, BOOL bDelete = TRUE) : CBaseThread(0)
|
||||
{
|
||||
m_pFile = NULL;
|
||||
m_sFilePath = _T("");
|
||||
m_sFileUrl = sFileUrl;
|
||||
m_bComplete = FALSE;
|
||||
m_bDelete = bDelete;
|
||||
}
|
||||
~CFileDownloader ()
|
||||
{
|
||||
if ( m_pFile )
|
||||
{
|
||||
::fclose( m_pFile );
|
||||
m_pFile = NULL;
|
||||
}
|
||||
if ( m_sFilePath.GetLength() > 0 && m_bDelete )
|
||||
{
|
||||
DeleteFileW( m_sFilePath.GetBuffer() );
|
||||
m_sFilePath = _T("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
CString GetFilePath()
|
||||
{
|
||||
return m_sFilePath;
|
||||
}
|
||||
BOOL IsFileDownloaded()
|
||||
{
|
||||
return m_bComplete;
|
||||
}
|
||||
protected :
|
||||
|
||||
unsigned int DownloadFile(CString sFileUrl)
|
||||
{
|
||||
|
||||
if ( FALSE == InternetGetConnectedState ( 0, 0 ) )
|
||||
return S_FALSE;
|
||||
|
||||
char sTempPath[MAX_PATH], sTempFile[MAX_PATH];
|
||||
if ( 0 == GetTempPathA( MAX_PATH, sTempPath ) )
|
||||
return S_FALSE;
|
||||
|
||||
if ( 0 == GetTempFileNameA( sTempPath, "CSS", 0, sTempFile ) )
|
||||
return S_FALSE;
|
||||
|
||||
m_pFile = ::fopen( sTempFile, "wb" );
|
||||
if ( !m_pFile )
|
||||
return S_FALSE;
|
||||
|
||||
m_sFilePath = CString( sTempFile );
|
||||
|
||||
|
||||
HINTERNET hInternetSession = InternetOpen ( _T ("Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
|
||||
if ( NULL == hInternetSession )
|
||||
return S_FALSE;
|
||||
|
||||
|
||||
CString sHTTPHdr = _T ("Range: bytes=0-0");
|
||||
|
||||
HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternetSession, sFileUrl, sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
|
||||
if ( NULL != hInternetOpenURL )
|
||||
{
|
||||
|
||||
if ( TRUE == QueryStatusCode ( hInternetOpenURL, TRUE ) )
|
||||
{
|
||||
|
||||
LONGLONG nFileSize = IsAccept_Ranges ( hInternetOpenURL );
|
||||
|
||||
InternetCloseHandle ( hInternetOpenURL );
|
||||
if ( -1 == nFileSize )
|
||||
{
|
||||
|
||||
|
||||
InternetCloseHandle ( hInternetSession );
|
||||
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
LONGLONG nStartByte = 0;
|
||||
while ( m_bRunThread )
|
||||
{
|
||||
|
||||
if ( nStartByte == nFileSize - 1 )
|
||||
{
|
||||
|
||||
InternetCloseHandle ( hInternetSession );
|
||||
return S_OK;
|
||||
}
|
||||
LONGLONG nEndByte = nStartByte + DOWNLOAD_FILE_SIZE;
|
||||
|
||||
if ( nEndByte >= nFileSize )
|
||||
nEndByte = nFileSize - 1;
|
||||
|
||||
|
||||
BYTE arrBuffer [ DOWNLOAD_FILE_SIZE ] = { 0 };
|
||||
DWORD dwBytesDownload = DownloadFilePath ( hInternetSession, arrBuffer, nStartByte, nEndByte, sFileUrl );
|
||||
|
||||
nStartByte = nEndByte;
|
||||
if ( -1 == dwBytesDownload )
|
||||
{
|
||||
|
||||
|
||||
InternetCloseHandle ( hInternetSession );
|
||||
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
|
||||
::fwrite( (BYTE*)arrBuffer, 1, dwBytesDownload, m_pFile );
|
||||
::fflush( m_pFile );
|
||||
|
||||
CheckSuspend ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
InternetCloseHandle ( hInternetSession );
|
||||
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
InternetCloseHandle ( hInternetSession );
|
||||
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
|
||||
InternetCloseHandle ( hInternetSession );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
DWORD DownloadFilePath ( HINTERNET hInternet, LPBYTE pBuffer, LONGLONG nStartByte, LONGLONG nEndByte, CString sFileURL )
|
||||
{
|
||||
|
||||
if ( NULL == hInternet )
|
||||
return -1;
|
||||
|
||||
|
||||
if ( nStartByte > nEndByte || !pBuffer )
|
||||
return -1;
|
||||
|
||||
|
||||
CString sHTTPHdr = _T (""); sHTTPHdr.Format ( _T ("Range: bytes=%I64d-%I64d"), nStartByte, nEndByte );
|
||||
|
||||
HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternet, sFileURL, sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
|
||||
if ( NULL == hInternetOpenURL )
|
||||
return -1;
|
||||
|
||||
if ( FALSE == QueryStatusCode ( hInternetOpenURL, TRUE ) )
|
||||
{
|
||||
|
||||
InternetCloseHandle ( hInternetOpenURL );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
DWORD dwBytesRead = 0;
|
||||
|
||||
if ( FALSE == InternetReadFile ( hInternetOpenURL, pBuffer, DOWNLOAD_FILE_SIZE, &dwBytesRead ) )
|
||||
{
|
||||
|
||||
InternetCloseHandle ( hInternetOpenURL );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
InternetCloseHandle ( hInternetOpenURL );
|
||||
|
||||
return dwBytesRead;
|
||||
}
|
||||
virtual DWORD ThreadProc ()
|
||||
{
|
||||
m_bComplete = FALSE;
|
||||
|
||||
CoInitialize ( NULL );
|
||||
|
||||
if ( S_OK != DownloadFile ( m_sFileUrl ) )
|
||||
{
|
||||
HRESULT hrResultAll = DownloadFileAll(m_sFileUrl, m_sFilePath);
|
||||
|
||||
if (S_OK != hrResultAll)
|
||||
{
|
||||
m_bRunThread = FALSE;
|
||||
CoUninitialize ();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
m_bRunThread = FALSE;
|
||||
CoUninitialize ();
|
||||
|
||||
m_bComplete = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL QueryStatusCode ( HINTERNET hInternet, BOOL bIsRanges )
|
||||
{
|
||||
|
||||
if ( NULL == hInternet )
|
||||
return FALSE;
|
||||
|
||||
|
||||
INT nResult = 0;
|
||||
|
||||
DWORD dwLengthDataSize = 4;
|
||||
|
||||
|
||||
if ( FALSE == HttpQueryInfo ( hInternet, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &nResult, &dwLengthDataSize, NULL ) )
|
||||
return FALSE;
|
||||
|
||||
|
||||
if ( HTTP_STATUS_NOT_FOUND == nResult )
|
||||
{
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
else if ( ( HTTP_STATUS_OK != nResult && FALSE == bIsRanges ) || ( HTTP_STATUS_PARTIAL_CONTENT != nResult && TRUE == bIsRanges ) )
|
||||
{
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LONGLONG IsAccept_Ranges ( HINTERNET hInternet )
|
||||
{
|
||||
|
||||
if ( NULL == hInternet )
|
||||
return -1;
|
||||
|
||||
|
||||
char arrResult [ MAX_SIZE ] = { 0 };
|
||||
|
||||
DWORD dwLengthDataSize = sizeof ( arrResult );
|
||||
|
||||
|
||||
if ( FALSE == HttpQueryInfoA ( hInternet, HTTP_QUERY_CONTENT_RANGE, &arrResult, &dwLengthDataSize, NULL ) )
|
||||
{
|
||||
|
||||
DWORD dwLastError = GetLastError ();
|
||||
if ( dwLastError == ERROR_HTTP_HEADER_NOT_FOUND )
|
||||
{
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if ( 0 >= dwLengthDataSize )
|
||||
return -1;
|
||||
|
||||
|
||||
CString strResult ( arrResult );
|
||||
|
||||
|
||||
LONGLONG nFileSize = 0;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
INT nStartIndex = strResult.Find ( CONTENT_RANGE );
|
||||
if ( -1 == nStartIndex )
|
||||
return -1;
|
||||
|
||||
|
||||
strResult = strResult.Mid ( nStartIndex + CONTENT_RANGE_SIZE );
|
||||
|
||||
nFileSize = _wtoi64 ( strResult.GetBuffer () );
|
||||
|
||||
if ( 0 < nFileSize )
|
||||
nFileSize += 1;
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return nFileSize;
|
||||
}
|
||||
|
||||
HRESULT DownloadFileAll(CString sFileURL, CString strFileOutput)
|
||||
{
|
||||
if ( m_pFile )
|
||||
{
|
||||
::fclose( m_pFile );
|
||||
m_pFile = NULL;
|
||||
}
|
||||
|
||||
return URLDownloadToFile (NULL, sFileURL, strFileOutput, NULL, NULL);
|
||||
}
|
||||
|
||||
public:
|
||||
static bool IsNeedDownload(CString FilePath)
|
||||
{
|
||||
int n1 = FilePath.Find(_T("www."));
|
||||
int n2 = FilePath.Find(_T("http://"));
|
||||
int n3 = FilePath.Find(_T("ftp://"));
|
||||
int n4 = FilePath.Find(_T("https://"));
|
||||
|
||||
if (((n1 >= 0) && (n1 < 10)) || ((n2 >= 0) && (n2 < 10)) || ((n3 >= 0) && (n3 < 10)) || ((n4 >= 0) && (n4 < 10)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected :
|
||||
|
||||
FILE *m_pFile;
|
||||
CString m_sFilePath;
|
||||
CString m_sFileUrl;
|
||||
|
||||
BOOL m_bComplete;
|
||||
BOOL m_bDelete;
|
||||
|
||||
};
|
||||
84
ActiveX/ASCOfficeDocxFile2/BinReader/FileWriter.h
Normal file
84
ActiveX/ASCOfficeDocxFile2/BinReader/FileWriter.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "NumberingWriter.h"
|
||||
#include "FontTableWriter.h"
|
||||
#include "HeaderFooterWriter.h"
|
||||
#include "DocumentWriter.h"
|
||||
#include "MediaWriter.h"
|
||||
#include "StylesWriter.h"
|
||||
#include "SettingWriter.h"
|
||||
#include "CommentsWriter.h"
|
||||
#include "ChartWriter.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
class FileWriter
|
||||
{
|
||||
public:
|
||||
PPTXFile::IAVSOfficeDrawingConverter* m_pDrawingConverter;
|
||||
LPSAFEARRAY m_pArray;
|
||||
CString& m_sThemePath;
|
||||
bool m_bSaveChartAsImg;
|
||||
ContentTypesWriter m_oContentTypesWriter;
|
||||
FontTableWriter m_oFontTableWriter;
|
||||
DocumentWriter m_oDocumentWriter;
|
||||
MediaWriter m_oMediaWriter;
|
||||
StylesWriter m_oStylesWriter;
|
||||
NumberingWriter m_oNumberingWriter;
|
||||
HeaderFooterWriter m_oHeaderFooterWriter;
|
||||
SettingWriter m_oSettingWriter;
|
||||
CommentsWriter m_oCommentsWriter;
|
||||
ChartWriter m_oChartWriter;
|
||||
int m_nDocPrIndex;
|
||||
public:
|
||||
FileWriter(CString sDirOutput,CString sFontDir, int nVersion, bool bSaveChartAsImg, PPTXFile::IAVSOfficeDrawingConverter* pDrawingConverter, LPSAFEARRAY pArray, CString& sThemePath):
|
||||
m_pDrawingConverter(pDrawingConverter),m_pArray(pArray),m_sThemePath(sThemePath),m_bSaveChartAsImg(bSaveChartAsImg),
|
||||
m_oContentTypesWriter(sDirOutput), m_oFontTableWriter(sDirOutput, sFontDir),
|
||||
m_oHeaderFooterWriter(sDirOutput, m_oContentTypesWriter),
|
||||
m_oMediaWriter(sDirOutput),
|
||||
m_oStylesWriter(sDirOutput, nVersion),
|
||||
m_oNumberingWriter(sDirOutput, m_oContentTypesWriter),
|
||||
m_oDocumentWriter(sDirOutput, m_oHeaderFooterWriter),
|
||||
m_oSettingWriter(sDirOutput, m_oHeaderFooterWriter),
|
||||
m_oCommentsWriter(sDirOutput, m_oContentTypesWriter),
|
||||
m_oChartWriter(sDirOutput, m_oContentTypesWriter),
|
||||
m_nDocPrIndex(0)
|
||||
{
|
||||
}
|
||||
public: int getNextDocPr()
|
||||
{
|
||||
m_nDocPrIndex++;
|
||||
return m_nDocPrIndex;
|
||||
}
|
||||
};
|
||||
}
|
||||
136
ActiveX/ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h
Normal file
136
ActiveX/ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Common.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
class ContentWriter
|
||||
{
|
||||
public:
|
||||
CStringWriter m_oContent;
|
||||
CStringWriter m_oSecPr;
|
||||
};
|
||||
class HdrFtrItem
|
||||
{
|
||||
public:
|
||||
HdrFtrItem(CString sDir)
|
||||
{
|
||||
}
|
||||
bool IsEmpty()
|
||||
{
|
||||
return m_sFilename.IsEmpty();
|
||||
}
|
||||
CString m_sFilename;
|
||||
ContentWriter Header;
|
||||
CString rId;
|
||||
};
|
||||
static CString g_string_hdr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
|
||||
static CString g_string_hdr_End = _T("</w:hdr>");
|
||||
|
||||
static CString g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
|
||||
static CString g_string_ftr_End = _T("</w:ftr>");
|
||||
|
||||
class HeaderFooterWriter
|
||||
{
|
||||
CString m_sDir;
|
||||
ContentTypesWriter& m_oContentTypesWriter;
|
||||
public:
|
||||
HdrFtrItem m_oHeaderFirst;
|
||||
HdrFtrItem m_oHeaderEven;
|
||||
HdrFtrItem m_oHeaderOdd;
|
||||
|
||||
HdrFtrItem m_oFooterFirst;
|
||||
HdrFtrItem m_oFooterEven;
|
||||
HdrFtrItem m_oFooterOdd;
|
||||
public:
|
||||
HeaderFooterWriter(CString sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter),
|
||||
m_oHeaderFirst(sDir),m_oHeaderEven(sDir),m_oHeaderOdd(sDir),m_oFooterFirst(sDir),m_oFooterEven(sDir),m_oFooterOdd(sDir)
|
||||
{
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
if(false == m_oHeaderFirst.IsEmpty())
|
||||
{
|
||||
WriteItem(_T("header"), m_oHeaderFirst.m_sFilename, m_oHeaderFirst.Header, true);
|
||||
|
||||
}
|
||||
if(false == m_oHeaderEven.IsEmpty())
|
||||
{
|
||||
WriteItem(_T("header"), m_oHeaderEven.m_sFilename, m_oHeaderEven.Header, true);
|
||||
|
||||
}
|
||||
if(false == m_oHeaderOdd.IsEmpty())
|
||||
{
|
||||
WriteItem(_T("header"), m_oHeaderOdd.m_sFilename, m_oHeaderOdd.Header, true);
|
||||
|
||||
}
|
||||
|
||||
if(false == m_oFooterFirst.IsEmpty())
|
||||
{
|
||||
WriteItem(_T("footer"), m_oFooterFirst.m_sFilename, m_oFooterFirst.Header, false);
|
||||
|
||||
}
|
||||
if(false == m_oFooterEven.IsEmpty())
|
||||
{
|
||||
WriteItem(_T("footer"), m_oFooterEven.m_sFilename, m_oFooterEven.Header, false);
|
||||
|
||||
}
|
||||
if(false == m_oFooterOdd.IsEmpty())
|
||||
{
|
||||
WriteItem(_T("footer"), m_oFooterOdd.m_sFilename, m_oFooterOdd.Header, false);
|
||||
|
||||
}
|
||||
}
|
||||
void WriteItem(CString sHeader, CString& sFilename, ContentWriter& m_oWriter, bool bHeader)
|
||||
{
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\word\\" + sFilename));
|
||||
if(bHeader)
|
||||
oFile.WriteStringUTF8(g_string_hdr_Start);
|
||||
else
|
||||
oFile.WriteStringUTF8(g_string_ftr_Start);
|
||||
oFile.WriteStringUTF8(m_oWriter.m_oContent.GetData());
|
||||
if(bHeader)
|
||||
oFile.WriteStringUTF8(g_string_hdr_End);
|
||||
else
|
||||
oFile.WriteStringUTF8(g_string_ftr_End);
|
||||
oFile.CloseFile();
|
||||
|
||||
|
||||
m_oContentTypesWriter.AddOverride(_T("/word/") + sFilename, _T("application/vnd.openxmlformats-officedocument.wordprocessingml.")+sHeader+_T("+xml"));
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
73
ActiveX/ASCOfficeDocxFile2/BinReader/MediaWriter.h
Normal file
73
ActiveX/ASCOfficeDocxFile2/BinReader/MediaWriter.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Common.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
class MediaWriter
|
||||
{
|
||||
CStringWriter m_oWriter;
|
||||
CString m_sDir;
|
||||
CString m_sMediaDir;
|
||||
public:
|
||||
CAtlArray<CString> m_aImageNames;
|
||||
long nImageCount;
|
||||
public:
|
||||
MediaWriter(CString sDir):m_sDir(sDir)
|
||||
{
|
||||
nImageCount = 0;
|
||||
m_sMediaDir = m_sDir + _T("\\word\\media");
|
||||
}
|
||||
void AddImage(CString& sImg)
|
||||
{
|
||||
CreateDirectory(m_sMediaDir, NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CString sNewImgName;sNewImgName.Format(_T("image%d.jpg"), (nImageCount + 1));
|
||||
CString sNewImg = m_sMediaDir;
|
||||
sNewImg += _T("\\") + sNewImgName;
|
||||
|
||||
CopyFile(sImg, sNewImg, FALSE);
|
||||
m_aImageNames.Add(sNewImgName);
|
||||
|
||||
|
||||
|
||||
|
||||
nImageCount++;
|
||||
}
|
||||
};
|
||||
}
|
||||
78
ActiveX/ASCOfficeDocxFile2/BinReader/NumberingWriter.h
Normal file
78
ActiveX/ASCOfficeDocxFile2/BinReader/NumberingWriter.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "ContentTypesWriter.h"
|
||||
#include "DocumentRelsWriter.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
static CString g_string_n_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:numbering xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
|
||||
static CString g_string_n_End = _T("</w:numbering>");
|
||||
|
||||
class NumberingWriter
|
||||
{
|
||||
CStringWriter m_oWriter;
|
||||
CString m_sDir;
|
||||
ContentTypesWriter& m_oContentTypesWriter;
|
||||
public:
|
||||
CStringWriter m_oANum;
|
||||
CStringWriter m_oNumList;
|
||||
public:
|
||||
NumberingWriter(CString sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
|
||||
{
|
||||
}
|
||||
bool IsEmpty()
|
||||
{
|
||||
return 0 == m_oANum.GetCurSize();
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
if(false == IsEmpty())
|
||||
{
|
||||
m_oWriter.WriteString(g_string_n_Start);
|
||||
m_oWriter.Write(m_oANum);
|
||||
m_oWriter.Write(m_oNumList);
|
||||
m_oWriter.WriteString(g_string_n_End);
|
||||
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\word\\numbering.xml"));
|
||||
oFile.WriteStringUTF8(m_oWriter.GetData());
|
||||
oFile.CloseFile();
|
||||
|
||||
|
||||
m_oContentTypesWriter.AddOverride(CString(_T("/word/numbering.xml")), CString(_T("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml")));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
2176
ActiveX/ASCOfficeDocxFile2/BinReader/ReaderClasses.h
Normal file
2176
ActiveX/ASCOfficeDocxFile2/BinReader/ReaderClasses.h
Normal file
File diff suppressed because it is too large
Load Diff
6108
ActiveX/ASCOfficeDocxFile2/BinReader/Readers.h
Normal file
6108
ActiveX/ASCOfficeDocxFile2/BinReader/Readers.h
Normal file
File diff suppressed because it is too large
Load Diff
77
ActiveX/ASCOfficeDocxFile2/BinReader/SettingWriter.h
Normal file
77
ActiveX/ASCOfficeDocxFile2/BinReader/SettingWriter.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Common.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
static CString g_string_set_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><w:settings xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:v=\"urn:schemas-microsoft-com:vml\">");
|
||||
static CString g_string_set_Default = _T("<w:zoom w:percent=\"100\"/><w:characterSpacingControl w:val=\"doNotCompress\"/><w:compat><w:compatSetting w:name=\"compatibilityMode\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"14\"/><w:compatSetting w:name=\"overrideTableStyleFontSizeAndJustification\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"enableOpenTypeFeatures\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"doNotFlipMirrorIndents\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/></w:compat><w:themeFontLang w:val=\"en-US\" w:eastAsia=\"zh-CN\"/><w:shapeDefaults><o:shapedefaults v:ext=\"edit\" spidmax=\"1026\"/><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout></w:shapeDefaults><w:decimalSymbol w:val=\".\"/><w:listSeparator w:val=\",\"/>");
|
||||
static CString g_string_set_End = _T("</w:settings>");
|
||||
|
||||
class SettingWriter
|
||||
{
|
||||
CString m_sDir;
|
||||
CStringWriter m_oSettingWriter;
|
||||
HeaderFooterWriter& m_oHeaderFooterWriter;
|
||||
public:
|
||||
SettingWriter(CString sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir),m_oHeaderFooterWriter(oHeaderFooterWriter)
|
||||
{
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
Prepare();
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\word\\settings.xml"));
|
||||
oFile.WriteStringUTF8(g_string_set_Start);
|
||||
oFile.WriteStringUTF8(m_oSettingWriter.GetData());
|
||||
oFile.WriteStringUTF8(g_string_set_Default);
|
||||
oFile.WriteStringUTF8(g_string_set_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
|
||||
void AddSetting(CString sSetting)
|
||||
{
|
||||
m_oSettingWriter.WriteString(sSetting);
|
||||
}
|
||||
void Prepare()
|
||||
{
|
||||
bool bevenAndOddHeaders = false;
|
||||
if(!m_oHeaderFooterWriter.m_oHeaderEven.rId.IsEmpty())
|
||||
bevenAndOddHeaders = true;
|
||||
if(!m_oHeaderFooterWriter.m_oFooterEven.rId.IsEmpty())
|
||||
bevenAndOddHeaders = true;
|
||||
if(bevenAndOddHeaders)
|
||||
AddSetting(_T("<w:evenAndOddHeaders/>"));
|
||||
}
|
||||
};
|
||||
}
|
||||
86
ActiveX/ASCOfficeDocxFile2/BinReader/StylesWriter.h
Normal file
86
ActiveX/ASCOfficeDocxFile2/BinReader/StylesWriter.h
Normal file
File diff suppressed because one or more lines are too long
151
ActiveX/ASCOfficeDocxFile2/BinReader/fontTableWriter.h
Normal file
151
ActiveX/ASCOfficeDocxFile2/BinReader/fontTableWriter.h
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "Common.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
static CString g_string_ft_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:fonts xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" mc:Ignorable=\"w14\">");
|
||||
static CString g_string_ft_End = _T("</w:fonts>");
|
||||
|
||||
class FontTableWriter
|
||||
{
|
||||
CStringWriter m_oWriter;
|
||||
CString m_sDir;
|
||||
ASCGraphics::IASCFontManager* m_pFontManager;
|
||||
public:
|
||||
CAtlMap<CString, int> m_mapFonts;
|
||||
public:
|
||||
FontTableWriter(CString sDir, CString sFontDir):m_sDir(sDir)
|
||||
{
|
||||
m_pFontManager = NULL;
|
||||
if(!sFontDir.IsEmpty())
|
||||
{
|
||||
CoCreateInstance(ASCGraphics::CLSID_CASCFontManager, NULL, CLSCTX_ALL, __uuidof(ASCGraphics::IASCFontManager), (void**)&m_pFontManager);
|
||||
if(NULL != m_pFontManager)
|
||||
{
|
||||
VARIANT var;
|
||||
var.vt = VT_BSTR;
|
||||
var.bstrVal = sFontDir.AllocSysString();
|
||||
m_pFontManager->SetAdditionalParam(L"InitializeFromFolder", var);
|
||||
RELEASESYSSTRING(var.bstrVal);
|
||||
|
||||
#ifdef BUILD_CONFIG_FULL_VERSION
|
||||
CString defaultFontName = _T("Arial");
|
||||
BSTR defFontName = defaultFontName.AllocSysString();
|
||||
m_pFontManager->SetDefaultFont(defFontName);
|
||||
SysFreeString(defFontName);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
~FontTableWriter()
|
||||
{
|
||||
RELEASEINTERFACE(m_pFontManager);
|
||||
}
|
||||
|
||||
void Write()
|
||||
{
|
||||
m_oWriter.WriteString(g_string_ft_Start);
|
||||
|
||||
|
||||
bool bCalibri = false;
|
||||
bool bTimes = false;
|
||||
bool bCambria = false;
|
||||
POSITION pos = m_mapFonts.GetStartPosition();
|
||||
while(NULL != pos)
|
||||
{
|
||||
CAtlMap<CString, int>::CPair* pair = m_mapFonts.GetNext(pos);
|
||||
if(NULL != pair)
|
||||
{
|
||||
const CString& sFontName = pair->m_key;
|
||||
if(_T("Calibri") == sFontName)
|
||||
bCalibri = true;
|
||||
else if(_T("Times New Roman") == sFontName)
|
||||
bTimes = true;
|
||||
else if(_T("Cambria") == sFontName)
|
||||
bCambria = true;
|
||||
WriteFont(sFontName);
|
||||
}
|
||||
}
|
||||
if(false == bCalibri)
|
||||
WriteFont(_T("Calibri"));
|
||||
if(false == bTimes)
|
||||
WriteFont(_T("Times New Roman"));
|
||||
if(false == bCambria)
|
||||
WriteFont(_T("Cambria"));
|
||||
|
||||
m_oWriter.WriteString(g_string_ft_End);
|
||||
|
||||
CFile oFile;
|
||||
oFile.CreateFile(m_sDir + _T("\\word\\fontTable.xml"));
|
||||
oFile.WriteStringUTF8(m_oWriter.GetData());
|
||||
oFile.CloseFile();
|
||||
}
|
||||
void WriteFont(CString sFontName)
|
||||
{
|
||||
CString sPanose;
|
||||
if(NULL != m_pFontManager)
|
||||
{
|
||||
long index = 0;
|
||||
BSTR bstrFontName = sFontName.AllocSysString();
|
||||
SAFEARRAY *psaArray = NULL;
|
||||
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
|
||||
m_pFontManager->GetParamsByFontName(bstrFontName, &psaArray, NULL);
|
||||
#else
|
||||
m_pFontManager->LoadFontByName(bstrFontName, 12, 0, 72, 72);
|
||||
m_pFontManager->GetPanose(&psaArray);
|
||||
#endif
|
||||
SysFreeString(bstrFontName);
|
||||
if(NULL != psaArray)
|
||||
{
|
||||
unsigned char* pData = static_cast<unsigned char*>(psaArray->pvData);
|
||||
for(int i = 0; i < psaArray->rgsabound->cElements; ++i)
|
||||
{
|
||||
unsigned char cElem = pData[i];
|
||||
if(cElem > 0xF)
|
||||
sPanose.AppendFormat(_T("%X"), cElem);
|
||||
else
|
||||
sPanose.AppendFormat(_T("0%X"), cElem);
|
||||
}
|
||||
}
|
||||
RELEASEARRAY(psaArray);
|
||||
}
|
||||
|
||||
CorrectString(sFontName);
|
||||
m_oWriter.WriteString(_T("<w:font w:name=\"") + sFontName + _T("\">"));
|
||||
if(!sPanose.IsEmpty())
|
||||
m_oWriter.WriteString(_T("<w:panose1 w:val=\"")+sPanose+_T("\"/>"));
|
||||
m_oWriter.WriteString(CString(_T("</w:font>")));
|
||||
}
|
||||
};
|
||||
}
|
||||
797
ActiveX/ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
Normal file
797
ActiveX/ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
Normal file
@@ -0,0 +1,797 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
namespace BinDocxRW
|
||||
{
|
||||
const double eps = 0.001;
|
||||
|
||||
const int Page_Width = 210;
|
||||
const int Page_Height = 297;
|
||||
|
||||
const int X_Left_Margin = 30;
|
||||
const int X_Right_Margin = 15;
|
||||
const int Y_Bottom_Margin = 20;
|
||||
const int Y_Top_Margin = 20;
|
||||
|
||||
const double Y_Default_Header = 12.5;
|
||||
const double Y_Default_Footer = 12.5;
|
||||
|
||||
const int shd_Clear = 0;
|
||||
const int shd_Nil = 1;
|
||||
|
||||
const int g_tabtype_left = 0;
|
||||
const int g_tabtype_right = 1;
|
||||
const int g_tabtype_center = 2;
|
||||
const int g_tabtype_clear = 3;
|
||||
|
||||
const int border_None = 0x0000;
|
||||
const int border_Single = 0x0001;
|
||||
|
||||
const int heightrule_AtLeast = 0x00;
|
||||
const int heightrule_Auto = 0x01;
|
||||
const int heightrule_Exact = 0x02;
|
||||
|
||||
const int vertalign_Baseline = 0;
|
||||
const int vertalign_SuperScript = 1;
|
||||
const int vertalign_SubScript = 2;
|
||||
|
||||
const int align_Right = 0;
|
||||
const int align_Left = 1;
|
||||
const int align_Center = 2;
|
||||
const int align_Justify = 3;
|
||||
|
||||
const int vertalignjc_Top = 0x00;
|
||||
const int vertalignjc_Center = 0x01;
|
||||
const int vertalignjc_Bottom = 0x02;
|
||||
|
||||
const int vmerge_Restart = 0x01;
|
||||
const int vmerge_Continue = 0x02;
|
||||
|
||||
const int linerule_AtLeast = 0;
|
||||
const int linerule_Auto = 1;
|
||||
const int linerule_Exact = 2;
|
||||
|
||||
const int orientation_Portrait = 0x00;
|
||||
const int orientation_Landscape = 0x01;
|
||||
|
||||
const int numbering_numfmt_None = 0x0000;
|
||||
const int numbering_numfmt_Bullet = 0x1001;
|
||||
const int numbering_numfmt_Decimal = 0x2002;
|
||||
const int numbering_numfmt_LowerRoman = 0x2003;
|
||||
const int numbering_numfmt_UpperRoman = 0x2004;
|
||||
const int numbering_numfmt_LowerLetter = 0x2005;
|
||||
const int numbering_numfmt_UpperLetter = 0x2006;
|
||||
const int numbering_numfmt_DecimalZero = 0x2007;
|
||||
|
||||
const int numbering_suff_Tab = 1;
|
||||
const int numbering_suff_Space = 2;
|
||||
const int numbering_suff_Nothing = 3;
|
||||
|
||||
const int tblwidth_Auto = 0x00;
|
||||
const int tblwidth_Mm = 0x01;
|
||||
const int tblwidth_Nil = 0x02;
|
||||
const int tblwidth_Pct = 0x03;
|
||||
|
||||
const int fontstyle_mask_regular = 1;
|
||||
const int fontstyle_mask_italic = 2;
|
||||
const int fontstyle_mask_bold = 4;
|
||||
const int fontstyle_mask_bolditalic = 8;
|
||||
|
||||
const int styletype_Character = 0x01;
|
||||
const int styletype_Numbering = 0x02;
|
||||
const int styletype_Paragraph = 0x03;
|
||||
const int styletype_Table = 0x04;
|
||||
|
||||
const int fieldstruct_none = 0;
|
||||
const int fieldstruct_toc = 1;
|
||||
const int fieldstruct_pagenum = 2;
|
||||
const int fieldstruct_hyperlink = 3;
|
||||
const int fieldstruct_locallink = 4;
|
||||
|
||||
const double g_dKoef_mm_to_pt = 72 / (2.54 * 10);
|
||||
const double g_dKoef_mm_to_twips = 20 * g_dKoef_mm_to_pt;
|
||||
const double g_dKoef_mm_to_emu = 36000;
|
||||
const double g_dKoef_mm_to_eightpoint = 8 * g_dKoef_mm_to_pt;
|
||||
const double g_dKoef_mm_to_hps = 2 * g_dKoef_mm_to_pt;
|
||||
|
||||
const static TCHAR* g_sFormatSignature = _T("DOCY");
|
||||
const int g_nFormatVersion = 4;
|
||||
namespace c_oAscWrapStyle{enum c_oSerFormat
|
||||
{
|
||||
Inline = 0,
|
||||
Flow = 1
|
||||
};}
|
||||
namespace c_oSerConstants{enum c_oSerConstants
|
||||
{
|
||||
ErrorFormat = -2,
|
||||
ErrorUnknown = -1,
|
||||
ReadOk = 0,
|
||||
ReadUnknown = 1,
|
||||
ErrorStream = 0x55
|
||||
};}
|
||||
namespace c_oSerTableTypes{enum c_oSerTableTypes
|
||||
{
|
||||
Signature = 0,
|
||||
Info = 1,
|
||||
Media = 2,
|
||||
Numbering = 3,
|
||||
HdrFtr = 4,
|
||||
Style = 5,
|
||||
Document = 6,
|
||||
Other = 7,
|
||||
Comments = 8,
|
||||
Settings = 9
|
||||
};}
|
||||
namespace c_oSerSigTypes{enum c_oSerSigTypes
|
||||
{
|
||||
Version = 0
|
||||
};}
|
||||
namespace c_oSerHdrFtrTypes{enum c_oSerHdrFtrTypes
|
||||
{
|
||||
Header = 0,
|
||||
Footer = 1,
|
||||
HdrFtr_First = 2,
|
||||
HdrFtr_Even = 3,
|
||||
HdrFtr_Odd = 4,
|
||||
HdrFtr_Content = 5,
|
||||
HdrFtr_Y2 = 6,
|
||||
HdrFtr_Y = 7
|
||||
};}
|
||||
namespace c_oSerNumTypes{enum c_oSerNumTypes
|
||||
{
|
||||
AbstractNums = 0,
|
||||
AbstractNum = 1,
|
||||
AbstractNum_Id = 2,
|
||||
AbstractNum_Type = 3,
|
||||
AbstractNum_Lvls = 4,
|
||||
Lvl = 5,
|
||||
lvl_Format = 6,
|
||||
lvl_Jc = 7,
|
||||
lvl_LvlText = 8,
|
||||
lvl_LvlTextItem = 9,
|
||||
lvl_LvlTextItemText = 10,
|
||||
lvl_LvlTextItemNum = 11,
|
||||
lvl_Restart = 12,
|
||||
lvl_Start = 13,
|
||||
lvl_Suff = 14,
|
||||
lvl_ParaPr = 15,
|
||||
lvl_TextPr = 16,
|
||||
Nums = 17,
|
||||
Num = 18,
|
||||
Num_ANumId = 19,
|
||||
Num_NumId = 20,
|
||||
lvl_PStyle = 21,
|
||||
NumStyleLink = 22,
|
||||
StyleLink = 23
|
||||
};}
|
||||
namespace c_oSerOtherTableTypes{enum c_oSerOtherTableTypes
|
||||
{
|
||||
ImageMap = 0,
|
||||
ImageMap_Src = 1,
|
||||
EmbeddedFonts = 2,
|
||||
DocxTheme = 3
|
||||
};}
|
||||
namespace c_oSerFontsTypes{enum c_oSerFontsTypes
|
||||
{
|
||||
Name = 0
|
||||
};}
|
||||
namespace c_oSerImageMapTypes{enum c_oSerImageMapTypes
|
||||
{
|
||||
Src = 0
|
||||
};}
|
||||
namespace c_oSerStyleTypes{enum c_oSerStyleTypes
|
||||
{
|
||||
Name = 0,
|
||||
BasedOn = 1,
|
||||
Next = 2
|
||||
};}
|
||||
namespace c_oSerPropLenType{enum c_oSerPropLenType
|
||||
{
|
||||
Null = 0,
|
||||
Byte = 1,
|
||||
Short = 2,
|
||||
Three = 3,
|
||||
Long = 4,
|
||||
Double = 5,
|
||||
Variable = 6
|
||||
};}
|
||||
namespace c_oSer_st{enum c_oSer_st
|
||||
{
|
||||
DefpPr = 0,
|
||||
DefrPr = 1,
|
||||
Styles = 2
|
||||
};}
|
||||
namespace c_oSer_sts{enum c_oSer_sts
|
||||
{
|
||||
Style = 0,
|
||||
Style_Id = 1,
|
||||
Style_Name = 2,
|
||||
Style_BasedOn = 3,
|
||||
Style_Next = 4,
|
||||
Style_TextPr = 5,
|
||||
Style_ParaPr = 6,
|
||||
Style_TablePr = 7,
|
||||
Style_Default = 8,
|
||||
Style_Type = 9,
|
||||
Style_qFormat = 10,
|
||||
Style_uiPriority = 11,
|
||||
Style_hidden = 12,
|
||||
Style_semiHidden = 13,
|
||||
Style_unhideWhenUsed = 14,
|
||||
Style_RowPr = 15,
|
||||
Style_CellPr = 16,
|
||||
Style_TblStylePr = 17
|
||||
};}
|
||||
namespace c_oSerProp_tblStylePrType{enum c_oSerProp_tblStylePrType
|
||||
{
|
||||
TblStylePr = 0,
|
||||
Type = 1,
|
||||
RunPr = 2,
|
||||
ParPr = 3,
|
||||
TblPr = 4,
|
||||
TrPr = 5,
|
||||
TcPr = 6
|
||||
};}
|
||||
namespace c_oSerProp_tblPrType{enum c_oSerProp_tblPrType
|
||||
{
|
||||
Rows = 0,
|
||||
Cols = 1,
|
||||
Jc = 2,
|
||||
TableInd = 3,
|
||||
TableW = 4,
|
||||
TableCellMar = 5,
|
||||
TableBorders = 6,
|
||||
Shd = 7,
|
||||
tblpPr = 8,
|
||||
Look = 9,
|
||||
Style = 10,
|
||||
tblpPr2 = 11,
|
||||
Layout = 12
|
||||
};}
|
||||
namespace c_oSer_tblpPrType{enum c_oSer_tblpPrType
|
||||
{
|
||||
Page = 0,
|
||||
X = 1,
|
||||
Y = 2,
|
||||
Paddings = 3
|
||||
};}
|
||||
namespace c_oSer_tblpPrType2{enum c_oSer_tblpPrType2
|
||||
{
|
||||
HorzAnchor = 0,
|
||||
TblpX = 1,
|
||||
TblpXSpec = 2,
|
||||
VertAnchor = 3,
|
||||
TblpY = 4,
|
||||
TblpYSpec = 5,
|
||||
Paddings = 6
|
||||
};}
|
||||
namespace c_oSerProp_pPrType{enum c_oSerProp_pPrType
|
||||
{
|
||||
ContextualSpacing = 0,
|
||||
Ind = 1,
|
||||
Ind_Left = 2,
|
||||
Ind_Right = 3,
|
||||
Ind_FirstLine = 4,
|
||||
Jc = 5,
|
||||
KeepLines = 6,
|
||||
KeepNext = 7,
|
||||
PageBreakBefore = 8,
|
||||
Spacing = 9,
|
||||
Spacing_Line = 10,
|
||||
Spacing_LineRule = 11,
|
||||
Spacing_Before = 12,
|
||||
Spacing_After = 13,
|
||||
Shd = 14,
|
||||
Tab = 17,
|
||||
Tab_Item = 18,
|
||||
Tab_Item_Pos = 19,
|
||||
Tab_Item_Val = 20,
|
||||
ParaStyle = 21,
|
||||
numPr = 22,
|
||||
numPr_lvl = 23,
|
||||
numPr_id = 24,
|
||||
WidowControl = 25,
|
||||
pPr_rPr = 26,
|
||||
pBdr = 27,
|
||||
Spacing_BeforeAuto = 28,
|
||||
Spacing_AfterAuto = 29,
|
||||
FramePr = 30
|
||||
};}
|
||||
namespace c_oSerProp_rPrType{enum c_oSerProp_rPrType
|
||||
{
|
||||
Bold = 0,
|
||||
Italic = 1,
|
||||
Underline = 2,
|
||||
Strikeout = 3,
|
||||
FontAscii = 4,
|
||||
FontHAnsi = 5,
|
||||
FontAE = 6,
|
||||
FontCS = 7,
|
||||
FontSize = 8,
|
||||
Color = 9,
|
||||
VertAlign = 10,
|
||||
HighLight = 11,
|
||||
HighLightTyped = 12,
|
||||
RStyle = 13,
|
||||
Spacing = 14,
|
||||
DStrikeout = 15,
|
||||
Caps = 16,
|
||||
SmallCaps = 17,
|
||||
Position = 18,
|
||||
FontHint = 19,
|
||||
BoldCs = 20,
|
||||
ItalicCs = 21,
|
||||
FontSizeCs = 22,
|
||||
Cs = 23,
|
||||
Rtl = 24,
|
||||
Lang = 25,
|
||||
LangBidi = 26,
|
||||
LangEA = 27
|
||||
};}
|
||||
namespace c_oSerProp_rowPrType{enum c_oSerProp_rowPrType
|
||||
{
|
||||
CantSplit = 0,
|
||||
GridAfter = 1,
|
||||
GridBefore = 2,
|
||||
Jc = 3,
|
||||
TableCellSpacing = 4,
|
||||
Height = 5,
|
||||
Height_Rule = 6,
|
||||
Height_Value = 7,
|
||||
WAfter = 8,
|
||||
WBefore = 9,
|
||||
WAfterBefore_W = 10,
|
||||
WAfterBefore_Type = 11,
|
||||
After = 12,
|
||||
Before = 13,
|
||||
TableHeader = 14
|
||||
};}
|
||||
namespace c_oSerProp_cellPrType{enum c_oSerProp_cellPrType
|
||||
{
|
||||
GridSpan = 0,
|
||||
Shd = 1,
|
||||
TableCellBorders = 2,
|
||||
TableCellW = 3,
|
||||
VAlign = 4,
|
||||
VMerge = 5,
|
||||
CellMar = 6
|
||||
};}
|
||||
namespace c_oSerProp_secPrType{enum c_oSerProp_secPrType
|
||||
{
|
||||
pgSz = 0,
|
||||
pgMar = 1,
|
||||
setting = 2
|
||||
};}
|
||||
namespace c_oSerProp_secPrSettingsType{enum c_oSerProp_secPrSettingsType
|
||||
{
|
||||
titlePg = 0,
|
||||
EvenAndOddHeaders = 1
|
||||
};}
|
||||
namespace c_oSerParType{enum c_oSerParType
|
||||
{
|
||||
Par = 0,
|
||||
pPr = 1,
|
||||
Content = 2,
|
||||
Table = 3,
|
||||
sectPr = 4,
|
||||
Run = 5,
|
||||
CommentStart = 6,
|
||||
CommentEnd = 7,
|
||||
OMathPara = 8,
|
||||
OMath = 9
|
||||
};}
|
||||
namespace c_oSerDocTableType{enum c_oSerDocTableType
|
||||
{
|
||||
tblPr = 0,
|
||||
tblGrid = 1,
|
||||
tblGrid_Item = 2,
|
||||
Content = 3,
|
||||
Row = 4,
|
||||
Row_Pr = 4,
|
||||
Row_Content = 5,
|
||||
Cell = 6,
|
||||
Cell_Pr = 7,
|
||||
Cell_Content = 8
|
||||
};}
|
||||
namespace c_oSerRunType{enum c_oSerRunType
|
||||
{
|
||||
run = 0,
|
||||
rPr = 1,
|
||||
tab = 2,
|
||||
pagenum = 3,
|
||||
pagebreak = 4,
|
||||
linebreak = 5,
|
||||
image = 6,
|
||||
table = 7,
|
||||
Content = 8,
|
||||
fldstart = 9,
|
||||
fldend = 10,
|
||||
CommentReference = 11,
|
||||
pptxDrawing = 12
|
||||
};}
|
||||
namespace c_oSerImageType{enum c_oSerImageType
|
||||
{
|
||||
MediaId = 0,
|
||||
Type = 1,
|
||||
Width = 2,
|
||||
Height = 3,
|
||||
X = 4,
|
||||
Y = 5,
|
||||
Page = 6,
|
||||
Padding = 7
|
||||
};}
|
||||
namespace c_oSerImageType2{enum c_oSerImageType2
|
||||
{
|
||||
Type = 0,
|
||||
PptxData = 1,
|
||||
AllowOverlap = 2,
|
||||
BehindDoc = 3,
|
||||
DistB = 4,
|
||||
DistL = 5,
|
||||
DistR = 6,
|
||||
DistT = 7,
|
||||
Hidden = 8,
|
||||
LayoutInCell = 9,
|
||||
Locked = 10,
|
||||
RelativeHeight = 11,
|
||||
BSimplePos = 12,
|
||||
EffectExtent = 13,
|
||||
Extent = 14,
|
||||
PositionH = 15,
|
||||
PositionV = 16,
|
||||
SimplePos = 17,
|
||||
WrapNone = 18,
|
||||
WrapSquare = 19,
|
||||
WrapThrough = 20,
|
||||
WrapTight = 21,
|
||||
WrapTopAndBottom = 22,
|
||||
Chart = 23,
|
||||
ChartImg = 24
|
||||
};}
|
||||
namespace c_oSerEffectExtent{enum c_oSerEffectExtent
|
||||
{
|
||||
Left = 0,
|
||||
Top = 1,
|
||||
Right = 2,
|
||||
Bottom = 3
|
||||
};}
|
||||
namespace c_oSerExtent{enum c_oSerExtent
|
||||
{
|
||||
Cx = 0,
|
||||
Cy = 1
|
||||
};}
|
||||
namespace c_oSerPosHV{enum c_oSerPosHV
|
||||
{
|
||||
RelativeFrom = 0,
|
||||
Align = 1,
|
||||
PosOffset = 2
|
||||
};}
|
||||
namespace c_oSerSimplePos{enum c_oSerSimplePos
|
||||
{
|
||||
X = 0,
|
||||
Y = 1
|
||||
};}
|
||||
namespace c_oSerWrapSquare{enum c_oSerWrapSquare
|
||||
{
|
||||
DistL = 0,
|
||||
DistT = 1,
|
||||
DistR = 2,
|
||||
DistB = 3,
|
||||
WrapText = 4,
|
||||
EffectExtent = 5
|
||||
};}
|
||||
namespace c_oSerWrapThroughTight{enum c_oSerWrapThroughTight
|
||||
{
|
||||
DistL = 0,
|
||||
DistR = 1,
|
||||
WrapText = 2,
|
||||
WrapPolygon = 3
|
||||
};}
|
||||
namespace c_oSerWrapTopBottom{enum c_oSerWrapTopBottom
|
||||
{
|
||||
DistT = 0,
|
||||
DistB = 1,
|
||||
EffectExtent = 2
|
||||
};}
|
||||
namespace c_oSerWrapPolygon{enum c_oSerWrapPolygon
|
||||
{
|
||||
Edited = 0,
|
||||
Start = 1,
|
||||
ALineTo = 2,
|
||||
LineTo = 3
|
||||
};}
|
||||
namespace c_oSerPoint2D{enum c_oSerPoint2D
|
||||
{
|
||||
X = 0,
|
||||
Y = 1
|
||||
};}
|
||||
namespace c_oSerBorderType{enum c_oSerBorderType
|
||||
{
|
||||
Color = 0,
|
||||
Space = 1,
|
||||
Size = 2,
|
||||
Value = 3
|
||||
};}
|
||||
namespace c_oSerShdType{enum c_oSerShdType
|
||||
{
|
||||
Value = 0,
|
||||
Color = 1
|
||||
};}
|
||||
namespace c_oSerPaddingType{enum c_oSerPaddingType
|
||||
{
|
||||
left = 0,
|
||||
top = 1,
|
||||
right = 2,
|
||||
bottom = 3
|
||||
};}
|
||||
namespace c_oSerMarginsType{enum c_oSerMarginsType
|
||||
{
|
||||
left = 0,
|
||||
top = 1,
|
||||
right = 2,
|
||||
bottom = 3
|
||||
};}
|
||||
namespace c_oSerBordersType{enum c_oSerBordersType
|
||||
{
|
||||
left = 0,
|
||||
top = 1,
|
||||
right = 2,
|
||||
bottom = 3,
|
||||
insideV = 4,
|
||||
insideH = 5,
|
||||
start = 6,
|
||||
end = 7,
|
||||
tl2br = 8,
|
||||
tr2bl = 9,
|
||||
bar = 10,
|
||||
between = 11
|
||||
};}
|
||||
namespace c_oSerWidthType{enum c_oSerWidthType
|
||||
{
|
||||
Type = 0,
|
||||
W = 1,
|
||||
WDocx = 2
|
||||
};}
|
||||
namespace c_oSer_pgSzType{enum c_oSer_pgSzType
|
||||
{
|
||||
W = 0,
|
||||
H = 1,
|
||||
Orientation = 2
|
||||
};}
|
||||
namespace c_oSer_pgMarType{enum c_oSer_pgMarType
|
||||
{
|
||||
Left = 0,
|
||||
Top = 1,
|
||||
Right = 2,
|
||||
Bottom = 3,
|
||||
Header = 4,
|
||||
Footer = 5
|
||||
};}
|
||||
namespace c_oSer_ColorType{enum c_oSer_ColorType
|
||||
{
|
||||
None = 0,
|
||||
Auto = 1
|
||||
};}
|
||||
namespace c_oSer_CommentsType{enum c_oSer_CommentsType
|
||||
{
|
||||
Comment = 0,
|
||||
Id = 1,
|
||||
Initials = 2,
|
||||
UserName = 3,
|
||||
UserId = 4,
|
||||
Date = 5,
|
||||
Text = 6,
|
||||
QuoteText = 7,
|
||||
Solved = 8,
|
||||
Replies = 9
|
||||
};}
|
||||
namespace c_oSer_SettingsType{enum c_oSer_SettingsType
|
||||
{
|
||||
ClrSchemeMapping = 0,
|
||||
DefaultTabStop = 1,
|
||||
MathPr = 2
|
||||
};}
|
||||
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
|
||||
{
|
||||
BrkBin = 0,
|
||||
BrkBinSub = 1,
|
||||
DefJc = 2,
|
||||
DispDef = 3,
|
||||
InterSp = 4,
|
||||
IntLim = 5,
|
||||
IntraSp = 6,
|
||||
LMargin = 7,
|
||||
MathFont = 8,
|
||||
NaryLim = 9,
|
||||
PostSp = 10,
|
||||
PreSp = 11,
|
||||
RMargin = 12,
|
||||
SmallFrac = 13,
|
||||
WrapIndent = 14,
|
||||
WrapRight = 15
|
||||
};}
|
||||
namespace c_oSer_ClrSchemeMappingType{enum c_oSer_ClrSchemeMappingType
|
||||
{
|
||||
Accent1 = 0,
|
||||
Accent2 = 1,
|
||||
Accent3 = 2,
|
||||
Accent4 = 3,
|
||||
Accent5 = 4,
|
||||
Accent6 = 5,
|
||||
Bg1 = 6,
|
||||
Bg2 = 7,
|
||||
FollowedHyperlink = 8,
|
||||
Hyperlink = 9,
|
||||
T1 = 10,
|
||||
T2 = 11
|
||||
};}
|
||||
namespace c_oSer_OMathBottomNodesType{enum c_oSer_OMathBottomNodesType
|
||||
{
|
||||
Aln = 0,
|
||||
AlnScr = 1,
|
||||
ArgSz = 2,
|
||||
BaseJc = 3,
|
||||
BegChr = 4,
|
||||
Brk = 5,
|
||||
CGp = 6,
|
||||
CGpRule = 7,
|
||||
Chr = 8,
|
||||
Count = 9,
|
||||
CSp = 10,
|
||||
CtrlPr = 11,
|
||||
DegHide = 12,
|
||||
Diff = 13,
|
||||
EndChr = 14,
|
||||
Grow = 15,
|
||||
HideBot = 16,
|
||||
HideLeft = 17,
|
||||
HideRight = 18,
|
||||
HideTop = 19,
|
||||
MJc = 20,
|
||||
LimLoc = 21,
|
||||
Lit = 22,
|
||||
MaxDist = 23,
|
||||
McJc = 24,
|
||||
Mcs = 25,
|
||||
NoBreak = 26,
|
||||
Nor = 27,
|
||||
ObjDist = 28,
|
||||
OpEmu = 29,
|
||||
PlcHide = 30,
|
||||
Pos = 31,
|
||||
RSp = 32,
|
||||
RSpRule = 33,
|
||||
Scr = 34,
|
||||
SepChr = 35,
|
||||
Show = 36,
|
||||
Shp = 37,
|
||||
StrikeBLTR = 38,
|
||||
StrikeH = 39,
|
||||
StrikeTLBR = 40,
|
||||
StrikeV = 41,
|
||||
Sty = 42,
|
||||
SubHide = 43,
|
||||
SupHide = 44,
|
||||
Transp = 45,
|
||||
Type = 46,
|
||||
VertJc = 47,
|
||||
ZeroAsc = 48,
|
||||
ZeroDesc = 49,
|
||||
ZeroWid = 50,
|
||||
Column = 51,
|
||||
Row = 52
|
||||
};}
|
||||
namespace c_oSer_OMathBottomNodesValType{enum c_oSer_OMathBottomNodesValType
|
||||
{
|
||||
Val = 0,
|
||||
AlnAt = 1
|
||||
};}
|
||||
namespace c_oSer_OMathContentType{enum c_oSer_OMathContentType
|
||||
{
|
||||
Acc = 0,
|
||||
AccPr = 1,
|
||||
ArgPr = 2,
|
||||
Bar = 3,
|
||||
BarPr = 4,
|
||||
BorderBox = 5,
|
||||
BorderBoxPr = 6,
|
||||
Box = 7,
|
||||
BoxPr = 8,
|
||||
Deg = 9,
|
||||
Den = 10,
|
||||
Delimiter = 11,
|
||||
DelimiterPr = 12,
|
||||
Element = 13,
|
||||
EqArr = 14,
|
||||
EqArrPr = 15,
|
||||
FName = 16,
|
||||
Fraction = 17,
|
||||
FPr = 18,
|
||||
Func = 19,
|
||||
FuncPr = 20,
|
||||
GroupChr = 21,
|
||||
GroupChrPr = 22,
|
||||
Lim = 23,
|
||||
LimLow = 24,
|
||||
LimLowPr = 25,
|
||||
LimUpp = 26,
|
||||
LimUppPr = 27,
|
||||
Matrix = 28,
|
||||
MathPr = 29,
|
||||
Mc = 30,
|
||||
McPr = 31,
|
||||
MPr = 32,
|
||||
Mr = 33,
|
||||
Nary = 34,
|
||||
NaryPr = 35,
|
||||
Num = 36,
|
||||
OMath = 37,
|
||||
OMathPara = 38,
|
||||
OMathParaPr = 39,
|
||||
Phant = 40,
|
||||
PhantPr = 41,
|
||||
MRun = 42,
|
||||
Rad = 43,
|
||||
RadPr = 44,
|
||||
RPr = 45,
|
||||
MRPr = 46,
|
||||
SPre = 47,
|
||||
SPrePr = 48,
|
||||
SSub = 49,
|
||||
SSubPr = 50,
|
||||
SSubSup = 51,
|
||||
SSubSupPr = 52,
|
||||
SSup = 53,
|
||||
SSupPr = 54,
|
||||
Sub = 55,
|
||||
Sup = 56,
|
||||
MText = 57,
|
||||
CtrlPr = 58
|
||||
};}
|
||||
namespace c_oSer_FramePrType{ enum c_oSer_FramePrType
|
||||
{
|
||||
DropCap = 0,
|
||||
H = 1,
|
||||
HAnchor = 2,
|
||||
HRule = 3,
|
||||
HSpace = 4,
|
||||
Lines = 5,
|
||||
VAnchor = 6,
|
||||
VSpace = 7,
|
||||
W = 8,
|
||||
Wrap = 9,
|
||||
X = 10,
|
||||
XAlign = 11,
|
||||
Y = 12,
|
||||
YAlign = 13
|
||||
};}
|
||||
}
|
||||
6352
ActiveX/ASCOfficeDocxFile2/BinWriter/BinWriters.h
Normal file
6352
ActiveX/ASCOfficeDocxFile2/BinWriter/BinWriters.h
Normal file
File diff suppressed because it is too large
Load Diff
728
ActiveX/ASCOfficeDocxFile2/BinWriter/StreamUtils.h
Normal file
728
ActiveX/ASCOfficeDocxFile2/BinWriter/StreamUtils.h
Normal file
@@ -0,0 +1,728 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "..\..\Common\MemoryUtils.h"
|
||||
|
||||
namespace Streams
|
||||
{
|
||||
class IMemoryObject
|
||||
{
|
||||
MemoryUtils::CMemoryUtils* m_pMemoryUtils;
|
||||
|
||||
public:
|
||||
|
||||
IMemoryObject()
|
||||
{
|
||||
m_pMemoryUtils = NULL;
|
||||
}
|
||||
|
||||
void SetMemoryUtils(MemoryUtils::CMemoryUtils* pMemoryUtils)
|
||||
{
|
||||
m_pMemoryUtils = pMemoryUtils;
|
||||
}
|
||||
MemoryUtils::CMemoryUtils* GetMemoryUtils()
|
||||
{
|
||||
return m_pMemoryUtils;
|
||||
}
|
||||
|
||||
void MemCopy(void* pDestination, void* pSource, int nBytes)
|
||||
{
|
||||
if (!m_pMemoryUtils)
|
||||
memcpy(pDestination, pSource, nBytes);
|
||||
else
|
||||
m_pMemoryUtils->memcpy(pDestination, pSource, nBytes);
|
||||
}
|
||||
void MemSet(void* pDestination, unsigned char nValue, int nBytes)
|
||||
{
|
||||
if (!m_pMemoryUtils)
|
||||
memset(pDestination, nValue, nBytes);
|
||||
else
|
||||
m_pMemoryUtils->memset(pDestination, nValue, nBytes);
|
||||
}
|
||||
};
|
||||
class IStream : public IMemoryObject
|
||||
{
|
||||
public:
|
||||
|
||||
virtual BOOL IsValid() const = 0;
|
||||
virtual BYTE* GetBuffer() = 0;
|
||||
|
||||
virtual void Seek(int nOrigin = 0) = 0;
|
||||
virtual int GetPosition() = 0;
|
||||
virtual BYTE* GetData() = 0;
|
||||
|
||||
virtual BOOL Peek(int nSizeToRead = 0) = 0;
|
||||
virtual BOOL Grow(int nGrowSize) = 0;
|
||||
|
||||
virtual BYTE ReadByte() = 0;
|
||||
virtual short ReadShort() = 0;
|
||||
virtual long ReadLong() = 0;
|
||||
virtual double ReadDouble() = 0;
|
||||
virtual float ReadFloat() = 0;
|
||||
virtual CString ReadString() = 0;
|
||||
virtual BYTE* ReadPointer(int nSize) = 0;
|
||||
|
||||
virtual void WriteByte(BYTE nValue) = 0;
|
||||
virtual void WriteShort(short nValue) = 0;
|
||||
virtual void WriteLong(long nValue) = 0;
|
||||
virtual void WriteDouble(double dValue) = 0;
|
||||
virtual void WriteFloat(float fValue) = 0;
|
||||
virtual void WriteString(CString& strValue) = 0;
|
||||
virtual void WritePointer(BYTE* pData, int nSize) = 0;
|
||||
};
|
||||
|
||||
class CBuffer : public IMemoryObject
|
||||
{
|
||||
protected:
|
||||
|
||||
BYTE* m_pData;
|
||||
LONG m_nSize;
|
||||
LONG m_nGrowSize;
|
||||
|
||||
public:
|
||||
|
||||
CBuffer()
|
||||
{
|
||||
m_pData = NULL;
|
||||
m_nSize = 0;
|
||||
m_nGrowSize = 4096;
|
||||
}
|
||||
~CBuffer()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void Destroy()
|
||||
{
|
||||
if (m_pData != NULL)
|
||||
{
|
||||
delete[] m_pData;
|
||||
m_pData = NULL;
|
||||
}
|
||||
|
||||
m_nSize = 0;
|
||||
}
|
||||
|
||||
LONG GetBufferSize()
|
||||
{
|
||||
return m_nSize;
|
||||
}
|
||||
LONG GetGrowSize()
|
||||
{
|
||||
return m_nGrowSize;
|
||||
}
|
||||
BYTE* GetBuffer()
|
||||
{
|
||||
return m_pData;
|
||||
}
|
||||
|
||||
BOOL IsValid()
|
||||
{
|
||||
if (m_pData == NULL)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL Create(LONG nSize, LONG nGrowSize = -1)
|
||||
{
|
||||
Destroy();
|
||||
|
||||
if (nSize < 1)
|
||||
return FALSE;
|
||||
|
||||
m_pData = new BYTE[nSize];
|
||||
|
||||
m_nSize = nSize;
|
||||
|
||||
if (!m_pData)
|
||||
return FALSE;
|
||||
|
||||
if (nGrowSize > 0)
|
||||
m_nGrowSize = nGrowSize;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
BOOL Create(BYTE* pData, LONG nSize, LONG nGrowSize = -1)
|
||||
{
|
||||
if (!pData)
|
||||
return FALSE;
|
||||
|
||||
if (!Create(nSize))
|
||||
return FALSE;
|
||||
|
||||
if (nGrowSize > 0)
|
||||
m_nGrowSize = nGrowSize;
|
||||
|
||||
MemCopy(m_pData, pData, nSize);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL Reallocate(LONG nSize)
|
||||
{
|
||||
if (!IsValid())
|
||||
return Create(nSize);
|
||||
|
||||
if (nSize <= m_nSize)
|
||||
return TRUE;
|
||||
|
||||
BYTE* pData = new BYTE[nSize];
|
||||
|
||||
if (!pData)
|
||||
return FALSE;
|
||||
|
||||
MemCopy(pData, m_pData, m_nSize);
|
||||
|
||||
delete[] m_pData;
|
||||
|
||||
m_pData = pData;
|
||||
|
||||
m_nSize = nSize;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
BOOL ReallocateGrow(LONG nGrowSize)
|
||||
{
|
||||
if (nGrowSize < m_nGrowSize)
|
||||
nGrowSize = m_nGrowSize;
|
||||
|
||||
if (nGrowSize < 0)
|
||||
return FALSE;
|
||||
|
||||
return Reallocate(m_nSize + nGrowSize);
|
||||
}
|
||||
};
|
||||
|
||||
class CStream : public IStream
|
||||
{
|
||||
protected:
|
||||
|
||||
BYTE* m_pBuffer;
|
||||
int m_nOrigin;
|
||||
|
||||
public:
|
||||
|
||||
CStream()
|
||||
{
|
||||
m_pBuffer = 0;
|
||||
m_nOrigin = 0;
|
||||
}
|
||||
|
||||
virtual BOOL IsValid() const
|
||||
{
|
||||
if (m_pBuffer)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
virtual BYTE* GetBuffer()
|
||||
{
|
||||
return m_pBuffer;
|
||||
}
|
||||
void SetBuffer(BYTE* pBuffer)
|
||||
{
|
||||
m_pBuffer = pBuffer;
|
||||
}
|
||||
|
||||
virtual BOOL Peek(int nSizeToRead = 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
virtual BOOL Grow(int nGrowSize)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
virtual void Seek(int nOrigin = 0)
|
||||
{
|
||||
m_nOrigin = nOrigin;
|
||||
}
|
||||
virtual int GetPosition()
|
||||
{
|
||||
return m_nOrigin;
|
||||
}
|
||||
virtual BYTE* GetData()
|
||||
{
|
||||
return m_pBuffer + m_nOrigin;
|
||||
}
|
||||
|
||||
virtual BYTE ReadByte()
|
||||
{
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(BYTE);
|
||||
|
||||
return *(BYTE*)(m_pBuffer + nOldOrigin);
|
||||
}
|
||||
virtual short ReadShort()
|
||||
{
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(short);
|
||||
|
||||
return *(short*)(m_pBuffer + nOldOrigin);
|
||||
}
|
||||
virtual long ReadLong()
|
||||
{
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(long);
|
||||
|
||||
return *(long*)(m_pBuffer + nOldOrigin);
|
||||
}
|
||||
virtual double ReadDouble()
|
||||
{
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(double);
|
||||
|
||||
return *(double*)(m_pBuffer + nOldOrigin);
|
||||
}
|
||||
virtual float ReadFloat()
|
||||
{
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(float);
|
||||
|
||||
return *(float*)(m_pBuffer + nOldOrigin);
|
||||
}
|
||||
virtual CString ReadString()
|
||||
{
|
||||
int nOldOrigin = m_nOrigin;
|
||||
int nTCharIndex = 0;
|
||||
|
||||
size_t nTCharSize = sizeof (TCHAR);
|
||||
TCHAR *pstrBuffer = (TCHAR *)(m_pBuffer + m_nOrigin);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
++nTCharIndex;
|
||||
m_nOrigin += (int)nTCharSize;
|
||||
|
||||
if (_T ('\0') == pstrBuffer [nTCharIndex - 1])
|
||||
break;
|
||||
}
|
||||
|
||||
return CString ((TCHAR *)(m_pBuffer + nOldOrigin));
|
||||
}
|
||||
virtual BYTE* ReadPointer(int nSize)
|
||||
{
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += nSize;
|
||||
|
||||
return (BYTE*)(m_pBuffer + nOldOrigin);
|
||||
}
|
||||
|
||||
virtual void WriteByte(BYTE nValue)
|
||||
{
|
||||
MemCopy(m_pBuffer + m_nOrigin, &nValue, sizeof(BYTE));
|
||||
|
||||
m_nOrigin += sizeof(BYTE);
|
||||
}
|
||||
virtual void WriteShort(short nValue)
|
||||
{
|
||||
MemCopy(m_pBuffer + m_nOrigin, &nValue, sizeof(short));
|
||||
|
||||
m_nOrigin += sizeof(short);
|
||||
}
|
||||
virtual void WriteLong(long nValue)
|
||||
{
|
||||
MemCopy(m_pBuffer + m_nOrigin, &nValue, sizeof(long));
|
||||
|
||||
m_nOrigin += sizeof(long);
|
||||
}
|
||||
virtual void WriteDouble(double dValue)
|
||||
{
|
||||
MemCopy(m_pBuffer + m_nOrigin, &dValue, sizeof(double));
|
||||
|
||||
m_nOrigin += sizeof(double);
|
||||
}
|
||||
virtual void WriteFloat(float fValue)
|
||||
{
|
||||
MemCopy(m_pBuffer + m_nOrigin, &fValue, sizeof(float));
|
||||
|
||||
m_nOrigin += sizeof(float);
|
||||
}
|
||||
virtual void WriteString(CString strValue)
|
||||
{
|
||||
size_t nTCharSize = sizeof (TCHAR);
|
||||
|
||||
TCHAR *pstr = strValue.GetBuffer ();
|
||||
|
||||
MemCopy (m_pBuffer + m_nOrigin, pstr, strValue.GetLength () * (int)nTCharSize);
|
||||
|
||||
m_nOrigin += strValue.GetLength () * (int)nTCharSize;
|
||||
|
||||
TCHAR *pstrBuffer = (TCHAR *)(m_pBuffer + m_nOrigin);
|
||||
pstrBuffer [0] = _T ('\0');
|
||||
|
||||
m_nOrigin += (int)nTCharSize;
|
||||
}
|
||||
virtual void WritePointer(BYTE* pData, int nSize)
|
||||
{
|
||||
MemCopy(m_pBuffer + m_nOrigin, pData, nSize);
|
||||
|
||||
m_nOrigin += nSize;
|
||||
}
|
||||
};
|
||||
|
||||
class CBufferedStream : public IStream
|
||||
{
|
||||
protected:
|
||||
|
||||
CBuffer* m_pBuffer;
|
||||
int m_nOrigin;
|
||||
|
||||
protected:
|
||||
|
||||
inline BOOL ValidatePosition(int nPosition)
|
||||
{
|
||||
if (!m_pBuffer)
|
||||
return FALSE;
|
||||
|
||||
return (nPosition <= m_pBuffer->GetBufferSize());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
CBufferedStream()
|
||||
{
|
||||
m_pBuffer = NULL;
|
||||
m_nOrigin = 0;
|
||||
}
|
||||
|
||||
virtual BOOL IsValid() const
|
||||
{
|
||||
if (!m_pBuffer)
|
||||
return FALSE;
|
||||
|
||||
return m_pBuffer->IsValid();
|
||||
}
|
||||
virtual BYTE* GetBuffer()
|
||||
{
|
||||
if (!m_pBuffer)
|
||||
return NULL;
|
||||
|
||||
return m_pBuffer->GetBuffer();
|
||||
}
|
||||
virtual void SetBuffer(CBuffer* pBuffer)
|
||||
{
|
||||
m_pBuffer = pBuffer;
|
||||
}
|
||||
|
||||
virtual BOOL Create(LONG nSize, LONG nGrowSize = -1)
|
||||
{
|
||||
if (m_pBuffer)
|
||||
return m_pBuffer->Create(nSize, nGrowSize);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
virtual BOOL Create(BYTE* pData, LONG nSize, LONG nGrowSize = -1)
|
||||
{
|
||||
if (m_pBuffer)
|
||||
return m_pBuffer->Create(pData, nSize, nGrowSize);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
void Skip(int nDif)
|
||||
{
|
||||
if(nDif > 0 && !Grow(nDif))
|
||||
return;
|
||||
if (!ValidatePosition(m_nOrigin + nDif))
|
||||
return;
|
||||
|
||||
m_nOrigin += nDif;
|
||||
}
|
||||
virtual void Seek(int nOrigin = 0)
|
||||
{
|
||||
if (!ValidatePosition(nOrigin))
|
||||
return;
|
||||
|
||||
m_nOrigin = nOrigin;
|
||||
}
|
||||
virtual int GetPosition()
|
||||
{
|
||||
return m_nOrigin;
|
||||
}
|
||||
virtual BYTE* GetData()
|
||||
{
|
||||
if (!m_pBuffer)
|
||||
return NULL;
|
||||
|
||||
return m_pBuffer->GetBuffer() + m_nOrigin;
|
||||
}
|
||||
|
||||
virtual BOOL Peek(int nSizeToRead = 0)
|
||||
{
|
||||
return ValidatePosition(m_nOrigin + nSizeToRead);
|
||||
}
|
||||
virtual BOOL Grow(int nGrowSize)
|
||||
{
|
||||
if (!m_pBuffer)
|
||||
return FALSE;
|
||||
|
||||
if (m_nOrigin + nGrowSize + 1 < m_pBuffer->GetBufferSize())
|
||||
return TRUE;
|
||||
|
||||
return m_pBuffer->ReallocateGrow(nGrowSize + 1);
|
||||
}
|
||||
|
||||
virtual BYTE ReadByte()
|
||||
{
|
||||
if (!Peek(sizeof(BYTE)))
|
||||
return 0;
|
||||
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(BYTE);
|
||||
|
||||
return *(BYTE*)(m_pBuffer->GetBuffer() + nOldOrigin);
|
||||
}
|
||||
virtual bool ReadBool()
|
||||
{
|
||||
return 0 != ReadByte();
|
||||
}
|
||||
virtual short ReadShort()
|
||||
{
|
||||
if (!Peek(sizeof(short)))
|
||||
return 0;
|
||||
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(short);
|
||||
|
||||
return *(short*)(m_pBuffer->GetBuffer() + nOldOrigin);
|
||||
}
|
||||
virtual long ReadLong()
|
||||
{
|
||||
if (!Peek(sizeof(long)))
|
||||
return 0;
|
||||
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(long);
|
||||
|
||||
return *(long*)(m_pBuffer->GetBuffer() + nOldOrigin);
|
||||
}
|
||||
virtual double ReadDouble()
|
||||
{
|
||||
if (!Peek(sizeof(double)))
|
||||
return 0;
|
||||
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(double);
|
||||
|
||||
return *(double*)(m_pBuffer->GetBuffer() + nOldOrigin);
|
||||
}
|
||||
double ReadDouble2()
|
||||
{
|
||||
|
||||
long nRes = ReadLong();
|
||||
return 1.0 * nRes / 100000;
|
||||
}
|
||||
virtual float ReadFloat()
|
||||
{
|
||||
if (!Peek(sizeof(float)))
|
||||
return 0;
|
||||
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += sizeof(float);
|
||||
|
||||
return *(float*)(m_pBuffer->GetBuffer() + nOldOrigin);
|
||||
}
|
||||
virtual CString ReadString()
|
||||
{
|
||||
int nOldOrigin = m_nOrigin;
|
||||
int nTCharIndex = 0;
|
||||
|
||||
size_t nTCharSize = sizeof (TCHAR);
|
||||
TCHAR *pstrBuffer = (TCHAR *)(m_pBuffer->GetBuffer() + m_nOrigin);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
if (!Peek ((int)nTCharSize))
|
||||
return _T ("");
|
||||
|
||||
++nTCharIndex;
|
||||
m_nOrigin += (int)nTCharSize;
|
||||
|
||||
if (_T ('\0') == pstrBuffer[nTCharIndex - 1])
|
||||
break;
|
||||
}
|
||||
|
||||
return CString ((TCHAR*)(m_pBuffer->GetBuffer() + nOldOrigin));
|
||||
}
|
||||
virtual CString ReadString2(int length)
|
||||
{
|
||||
return CString((wchar_t*)ReadPointer(length), length / 2);
|
||||
}
|
||||
virtual BYTE* ReadPointer(int nSize)
|
||||
{
|
||||
if (!Peek(nSize))
|
||||
return NULL;
|
||||
|
||||
int nOldOrigin = m_nOrigin;
|
||||
|
||||
m_nOrigin += nSize;
|
||||
|
||||
return (BYTE*)(m_pBuffer->GetBuffer() + nOldOrigin);
|
||||
}
|
||||
void WriteBool(bool bValue)
|
||||
{
|
||||
WriteByte(false == bValue ? 0 : 1);
|
||||
}
|
||||
virtual void WriteByte(BYTE nValue)
|
||||
{
|
||||
if (!Grow(sizeof(BYTE)))
|
||||
return;
|
||||
|
||||
MemCopy(m_pBuffer->GetBuffer() + m_nOrigin, &nValue, sizeof(BYTE));
|
||||
|
||||
m_nOrigin += sizeof(BYTE);
|
||||
}
|
||||
virtual void WriteShort(short nValue)
|
||||
{
|
||||
if (!Grow(sizeof(short)))
|
||||
return;
|
||||
|
||||
MemCopy(m_pBuffer->GetBuffer() + m_nOrigin, &nValue, sizeof(short));
|
||||
|
||||
m_nOrigin += sizeof(short);
|
||||
}
|
||||
virtual void WriteLong(long nValue)
|
||||
{
|
||||
if (!Grow(sizeof(long)))
|
||||
return;
|
||||
|
||||
MemCopy(m_pBuffer->GetBuffer() + m_nOrigin, &nValue, sizeof(long));
|
||||
|
||||
m_nOrigin += sizeof(long);
|
||||
}
|
||||
virtual void WriteDouble(double dValue)
|
||||
{
|
||||
if (!Grow(sizeof(double)))
|
||||
return;
|
||||
|
||||
MemCopy(m_pBuffer->GetBuffer() + m_nOrigin, &dValue, sizeof(double));
|
||||
|
||||
m_nOrigin += sizeof(double);
|
||||
}
|
||||
virtual void WriteDouble2(double dValue)
|
||||
{
|
||||
long nValue = (long)(dValue * 100000);
|
||||
WriteLong(nValue);
|
||||
}
|
||||
virtual void WriteFloat(float fValue)
|
||||
{
|
||||
if (!Grow(sizeof(float)))
|
||||
return;
|
||||
|
||||
MemCopy(m_pBuffer->GetBuffer() + m_nOrigin, &fValue, sizeof(float));
|
||||
|
||||
m_nOrigin += sizeof(float);
|
||||
}
|
||||
virtual void WriteString(CString& strValue)
|
||||
{
|
||||
size_t nTCharSize = sizeof (TCHAR);
|
||||
|
||||
if (!Grow (strValue.GetLength () * (int)nTCharSize + (int)nTCharSize))
|
||||
return;
|
||||
|
||||
TCHAR* pstr = strValue.GetBuffer ();
|
||||
|
||||
MemCopy (m_pBuffer->GetBuffer () + m_nOrigin, pstr, strValue.GetLength () * (int)nTCharSize);
|
||||
|
||||
m_nOrigin += strValue.GetLength () * (int)nTCharSize;
|
||||
|
||||
|
||||
TCHAR *pstrBuffer = (TCHAR *)(m_pBuffer->GetBuffer () + m_nOrigin);
|
||||
pstrBuffer [0] = _T ('\0');
|
||||
|
||||
m_nOrigin += (int)nTCharSize;
|
||||
}
|
||||
virtual void WriteString1(CString& strValue)
|
||||
{
|
||||
int nStrLen = strValue.GetLength();
|
||||
WriteLong( nStrLen);
|
||||
|
||||
size_t nTCharSize = sizeof (TCHAR);
|
||||
if (!Grow ( nStrLen * (int)nTCharSize))
|
||||
return;
|
||||
TCHAR* pstr = strValue.GetBuffer ();
|
||||
|
||||
MemCopy (m_pBuffer->GetBuffer () + m_nOrigin, pstr, strValue.GetLength () * (int)nTCharSize);
|
||||
|
||||
m_nOrigin += strValue.GetLength () * (int)nTCharSize;
|
||||
}
|
||||
virtual void WriteString2(CString& strValue)
|
||||
{
|
||||
int nStrLen = strValue.GetLength();
|
||||
WriteLong( 2 * nStrLen);
|
||||
|
||||
size_t nTCharSize = sizeof (TCHAR);
|
||||
if (!Grow ( nStrLen * (int)nTCharSize))
|
||||
return;
|
||||
TCHAR* pstr = strValue.GetBuffer ();
|
||||
|
||||
MemCopy (m_pBuffer->GetBuffer () + m_nOrigin, pstr, strValue.GetLength () * (int)nTCharSize);
|
||||
|
||||
m_nOrigin += strValue.GetLength () * (int)nTCharSize;
|
||||
}
|
||||
virtual void WriteString3(CString& strValue)
|
||||
{
|
||||
int nStrLen = strValue.GetLength();
|
||||
|
||||
size_t nTCharSize = sizeof (TCHAR);
|
||||
if (!Grow ( nStrLen * (int)nTCharSize))
|
||||
return;
|
||||
TCHAR* pstr = strValue.GetBuffer ();
|
||||
|
||||
MemCopy (m_pBuffer->GetBuffer () + m_nOrigin, pstr, strValue.GetLength () * (int)nTCharSize);
|
||||
|
||||
m_nOrigin += strValue.GetLength () * (int)nTCharSize;
|
||||
}
|
||||
virtual void WritePointer(BYTE* pData, int nSize)
|
||||
{
|
||||
if (!Grow(nSize))
|
||||
return;
|
||||
|
||||
MemCopy(m_pBuffer->GetBuffer() + m_nOrigin, pData, nSize);
|
||||
|
||||
m_nOrigin += nSize;
|
||||
}
|
||||
};
|
||||
}
|
||||
208
ActiveX/ASCOfficeDocxFile2/DocWrapper/FontProcessor.cpp
Normal file
208
ActiveX/ASCOfficeDocxFile2/DocWrapper/FontProcessor.cpp
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "FontProcessor.h"
|
||||
|
||||
#include "../../Common/ASCUtils.h"
|
||||
#include "Foreign/StringWriter.h"
|
||||
|
||||
using SimpleTypes::EPitch;
|
||||
|
||||
namespace DocWrapper {
|
||||
|
||||
bool FontProcessor::useSystemFonts = false;
|
||||
|
||||
FontProcessor::FontProcessor()
|
||||
: fontManager(NULL) {}
|
||||
FontProcessor::~FontProcessor() {
|
||||
RELEASEINTERFACE(fontManager);
|
||||
}
|
||||
|
||||
void FontProcessor::setFontDir(const CString& fontDir) {
|
||||
this->fontDir = fontDir;
|
||||
initFontManager();
|
||||
}
|
||||
void FontProcessor::setFontTable(OOX::CFontTable* fontTable) {
|
||||
for (int i = 0; i < fontTable->m_arrFonts.GetSize(); ++i)
|
||||
addToFontMap(fontTable->m_arrFonts[i]);
|
||||
}
|
||||
|
||||
CString FontProcessor::getFont(const CString& name) {
|
||||
CString fontName = _T("Arial");
|
||||
if (fontMap.find(name) != fontMap.end())
|
||||
fontName = fontMap[name];
|
||||
else
|
||||
{
|
||||
OOX::CFont font;
|
||||
font.m_sName = name;
|
||||
addToFontMap(font);
|
||||
if (fontMap.find(name) != fontMap.end())
|
||||
fontName = fontMap[name];
|
||||
}
|
||||
return fontName;
|
||||
}
|
||||
void FontProcessor::getFonts(CAtlArray<CString>& fonts) {
|
||||
fonts.RemoveAll();
|
||||
std::map<CString, CString>::iterator it = fontMap.begin();
|
||||
for (; it != fontMap.end(); ++it) {
|
||||
bool contains = false;
|
||||
for (int i = 0; i < (int) fonts.GetCount(); ++i)
|
||||
if (fonts[i] == it->second) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
if (!contains)
|
||||
fonts.Add(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
void FontProcessor::initFontManager() {
|
||||
RELEASEINTERFACE(fontManager);
|
||||
|
||||
fontManager = NULL;
|
||||
CoInitialize(NULL);
|
||||
CoCreateInstance(ASCGraphics::CLSID_CASCFontManager, NULL, CLSCTX_ALL, __uuidof(ASCGraphics::IASCFontManager), (void**) &fontManager);
|
||||
|
||||
VARIANT var;
|
||||
var.vt = VT_BSTR;
|
||||
var.bstrVal = fontDir.AllocSysString();
|
||||
fontManager->SetAdditionalParam(L"InitializeFromFolder", var);
|
||||
RELEASESYSSTRING(var.bstrVal);
|
||||
|
||||
if (useSystemFonts) {
|
||||
CString options = _T("<FontManagerOptions><FontDir path='") + fontDir + _T("' /></FontManagerOptions>");
|
||||
BSTR bsOptions = options.AllocSysString();
|
||||
|
||||
|
||||
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
|
||||
fontManager->Init(bsOptions, VARIANT_TRUE, VARIANT_FALSE);
|
||||
#else
|
||||
fontManager->Initialize(bsOptions);
|
||||
#endif
|
||||
|
||||
|
||||
SysFreeString(bsOptions);
|
||||
}
|
||||
|
||||
#ifdef BUILD_CONFIG_FULL_VERSION
|
||||
CString defaultFontName = _T("Arial");
|
||||
BSTR defFontName = defaultFontName.AllocSysString();
|
||||
fontManager->SetDefaultFont(defFontName);
|
||||
SysFreeString(defFontName);
|
||||
#endif
|
||||
}
|
||||
void FontProcessor::addToFontMap(OOX::CFont& font) {
|
||||
CStringWriter parw;
|
||||
parw.WriteString(CString(_T("<FontProperties>")));
|
||||
if(font.m_oCharset.IsInit())
|
||||
{
|
||||
SimpleTypes::EFontCharset eCharset = font.m_oCharset->GetValue();
|
||||
|
||||
if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset)
|
||||
parw.WriteString(_T("<Charset value='") + font.m_oCharset->ToString() + _T("'/>"));
|
||||
}
|
||||
if(font.m_sName.IsEmpty())
|
||||
parw.WriteString(CString(_T("<Name value='Arial'/>")));
|
||||
else
|
||||
{
|
||||
CString sName = font.m_sName;
|
||||
ToXmlString(sName);
|
||||
parw.WriteString(_T("<Name value='")+ sName + _T("'/>"));
|
||||
}
|
||||
if (font.m_oAltName.IsInit())
|
||||
{
|
||||
CString sAltName = *font.m_oAltName;
|
||||
ToXmlString(sAltName);
|
||||
parw.WriteString(_T("<AltName value='") + sAltName + _T("'/>"));
|
||||
}
|
||||
parw.WriteString(_T("<FamilyClass name='") + font.m_oFamily.ToString() + _T("'/>"));
|
||||
if(font.m_oPanose.IsInit())
|
||||
parw.WriteString(_T("<Panose value='") + font.m_oPanose->ToString() + _T("'/>"));
|
||||
if (font.m_oPitch.GetValue() == SimpleTypes::pitchFixed)
|
||||
parw.WriteString(CString(_T("<FixedWidth value='1'/>")));
|
||||
else
|
||||
parw.WriteString(CString(_T("<FixedWidth value='0'/>")));
|
||||
parw.WriteString(CString(_T("<UnicodeRange ")));
|
||||
if (font.m_oUsb0.IsInit())
|
||||
parw.WriteString(_T("range1='") + font.m_oUsb0->ToString() + _T("' "));
|
||||
if (font.m_oUsb1.IsInit())
|
||||
parw.WriteString(_T("range2='") + font.m_oUsb1->ToString() + _T("' "));
|
||||
if (font.m_oUsb2.IsInit())
|
||||
parw.WriteString(_T("range3='") + font.m_oUsb2->ToString() + _T("' "));
|
||||
if (font.m_oUsb3.IsInit())
|
||||
parw.WriteString(_T("range4='") + font.m_oUsb3->ToString() + _T("' "));
|
||||
if (font.m_oCsb0.IsInit())
|
||||
parw.WriteString(_T("coderange1='") + font.m_oCsb0->ToString() + _T("' "));
|
||||
if (font.m_oCsb1.IsInit())
|
||||
parw.WriteString(_T("coderange2='") + font.m_oCsb1->ToString() + _T("' "));
|
||||
parw.WriteString(CString(_T("/>")));
|
||||
parw.WriteString(CString(_T("</FontProperties>")));
|
||||
CString params = parw.GetData();
|
||||
|
||||
BSTR fontPath = NULL;
|
||||
BSTR familyName = NULL;
|
||||
long index = 0;
|
||||
BSTR bstrParams = params.AllocSysString();
|
||||
|
||||
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
|
||||
fontManager->GetWinFontByParams(bstrParams, &familyName, &fontPath, NULL, &index);
|
||||
#else
|
||||
fontManager->GetWinFontByParams(bstrParams, &fontPath, &index);
|
||||
int status = fontManager->LoadFontFromFile(fontPath, 12, 72, 72, index);
|
||||
SysFreeString(fontPath);
|
||||
|
||||
fontManager->GetFamilyName(&familyName);
|
||||
#endif
|
||||
|
||||
CString resFontName = familyName;
|
||||
|
||||
SysFreeString(bstrParams);
|
||||
SysFreeString(fontPath);
|
||||
SysFreeString(familyName);
|
||||
|
||||
fontMap[font.m_sName] = resFontName;
|
||||
}
|
||||
|
||||
bool FontProcessor::checkRange(OOX::CFont& font) {
|
||||
return true;
|
||||
|
||||
}
|
||||
void FontProcessor::ToXmlString(CString& strVal)
|
||||
{
|
||||
strVal.Replace(L"&", L"&");
|
||||
strVal.Replace(L"'", L"'");
|
||||
strVal.Replace(L"<", L"<");
|
||||
strVal.Replace(L">", L">");
|
||||
strVal.Replace(L"\"", L""");
|
||||
}
|
||||
|
||||
}
|
||||
72
ActiveX/ASCOfficeDocxFile2/DocWrapper/FontProcessor.h
Normal file
72
ActiveX/ASCOfficeDocxFile2/DocWrapper/FontProcessor.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "../stdafx.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace DocWrapper {
|
||||
|
||||
class FontProcessor {
|
||||
ASCGraphics::IASCFontManager* fontManager;
|
||||
std::map<CString, CString> fontMap;
|
||||
|
||||
CString fontDir;
|
||||
|
||||
public:
|
||||
static bool useSystemFonts;
|
||||
|
||||
public:
|
||||
FontProcessor();
|
||||
~FontProcessor();
|
||||
|
||||
void setFontDir(const CString& fontDir);
|
||||
void setFontTable(OOX::CFontTable* fontTable);
|
||||
|
||||
CString getFont(const CString& name);
|
||||
void getFonts(CAtlArray<CString>& fonts);
|
||||
|
||||
ASCGraphics::IASCFontManager* getFontManager() {
|
||||
return fontManager;
|
||||
}
|
||||
|
||||
private:
|
||||
void initFontManager();
|
||||
|
||||
void addToFontMap(OOX::CFont& font);
|
||||
|
||||
bool checkRange(OOX::CFont& font);
|
||||
void ToXmlString(CString& strVal);
|
||||
};
|
||||
|
||||
}
|
||||
493
ActiveX/ASCOfficeDocxFile2/DocxFile2.h
Normal file
493
ActiveX/ASCOfficeDocxFile2/DocxFile2.h
Normal file
@@ -0,0 +1,493 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
#include "..\Common\ASCUtils.h"
|
||||
#include "..\Common\MappingFile.h"
|
||||
#include "BinWriter/BinWriters.h"
|
||||
#include "BinReader/Readers.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
|
||||
|
||||
#define BUFFER_GROW_SIZE 1 * 1024 * 1024
|
||||
|
||||
|
||||
[ object, uuid("98B1ECA8-9575-4eec-B327-8F8BA3FA232C"), dual, pointer_default(unique) ]
|
||||
__interface IAVSOfficeDocxFile2: IDispatch
|
||||
{
|
||||
[id(1)] HRESULT OpenFile([in] BSTR bsInputDir, [in] BSTR bsFileDst);
|
||||
[id(2)] HRESULT GetJfdoc([in] BSTR bsInputDir, [out] BSTR* bsJfdoc);
|
||||
|
||||
[id(3)] HRESULT SetMediaDir([in] BSTR bsMediaDir);
|
||||
[id(4)] HRESULT SetFontDir([in] BSTR bsFontDir);
|
||||
|
||||
[id(5)] HRESULT SetUseSystemFonts([in] BOOL useSystemFonts);
|
||||
[id(6)] HRESULT GetBinaryContent([in] BSTR bsTxContent, [out, satype("BYTE")] SAFEARRAY** ppBinary);
|
||||
|
||||
[id(10)] HRESULT Write([in] BSTR bstrFileIn, [in] BSTR bstrFileOut);
|
||||
[id(20)] HRESULT GetXmlContent([in, satype("BYTE")] SAFEARRAY* pBinaryObj, [in] LONG lStart, [in] LONG lLength, [out] BSTR* bsXml);
|
||||
|
||||
[id(2000 + 0)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
|
||||
[id(2001 + 1)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
|
||||
};
|
||||
|
||||
|
||||
[uuid("C3CF75C3-28FE-4b2c-A770-5952ADF4EAC2"), dispinterface]
|
||||
__interface _IAVSOfficeDocxFile2Events
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
[ coclass, default(IAVSOfficeDocxFile2), threading(apartment), event_source(com), vi_progid("DocxFile2"), progid("DocxFile2.Rend.1"), version(1.0), uuid("CD07583A-6362-454f-A14E-542AE706FFBC") ]
|
||||
class ATL_NO_VTABLE CAVSOfficeDocxFile2 : public IAVSOfficeDocxFile2
|
||||
{
|
||||
public:
|
||||
__event __interface _IAVSOfficeDocxFile2Events;
|
||||
|
||||
private:
|
||||
CString mediaDir;
|
||||
CString fontDir;
|
||||
CString m_strEmbeddedFontsDirectory;
|
||||
BinDocxRW::BinaryFileWriter* m_oBinaryFileWriter;
|
||||
CString m_sFontDir;
|
||||
bool m_bSaveChartAsImg;
|
||||
Writers::FileWriter* m_pCurFileWriter;
|
||||
|
||||
bool m_bIsNoBase64Save;
|
||||
public:
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
CAVSOfficeDocxFile2()
|
||||
{
|
||||
m_oBinaryFileWriter = NULL;
|
||||
m_bSaveChartAsImg = false;
|
||||
m_bIsNoBase64Save = false;
|
||||
}
|
||||
~CAVSOfficeDocxFile2()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
STDMETHOD(OpenFile)(BSTR bsInputDir, BSTR bsFileDst)
|
||||
{
|
||||
if (mediaDir == _T("")) {
|
||||
OOX::CPath path(bsFileDst);
|
||||
mediaDir = path.GetDirectory() + _T("/media/");
|
||||
CreateDirectoryW(mediaDir, NULL);
|
||||
}
|
||||
Streams::CBuffer oBuffer;
|
||||
oBuffer.Create(BUFFER_GROW_SIZE, BUFFER_GROW_SIZE);
|
||||
Streams::CBufferedStream oBufferedStream;
|
||||
oBufferedStream.SetBuffer(&oBuffer);
|
||||
|
||||
DocWrapper::FontProcessor fp;
|
||||
fp.setFontDir(fontDir);
|
||||
PPTXFile::IOfficeFontPicker* pFontPicker = NULL;
|
||||
CoCreateInstance(__uuidof(PPTXFile::COfficeFontPicker), NULL, CLSCTX_ALL, __uuidof(PPTXFile::IOfficeFontPicker), (void**)(&pFontPicker));
|
||||
BSTR bstrFontDir1 = fontDir.AllocSysString();
|
||||
pFontPicker->Init(bstrFontDir1);
|
||||
SysFreeString(bstrFontDir1);
|
||||
NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager = NULL;
|
||||
if(false == m_strEmbeddedFontsDirectory.IsEmpty())
|
||||
{
|
||||
CreateDirectoryW(m_strEmbeddedFontsDirectory, NULL);
|
||||
|
||||
BSTR bstrEmbeddedFontsDirectory = m_strEmbeddedFontsDirectory.AllocSysString();
|
||||
pFontPicker->SetEmbeddedFontsDirectory(bstrEmbeddedFontsDirectory);
|
||||
SysFreeString(bstrEmbeddedFontsDirectory);
|
||||
|
||||
VARIANT vt;
|
||||
pFontPicker->GetAdditionalParam(_T("NativeCutter"), &vt);
|
||||
pEmbeddedFontsManager = (NSFontCutter::CEmbeddedFontsManager*)vt.pvRecord;
|
||||
|
||||
|
||||
pEmbeddedFontsManager->CheckString(CString(_T("abcdefghijklmnopqrstuvwxyz")));
|
||||
|
||||
|
||||
pEmbeddedFontsManager->CheckFont(_T("Wingdings 3"), fp.getFontManager());
|
||||
pEmbeddedFontsManager->CheckFont(_T("Arial"), fp.getFontManager());
|
||||
|
||||
}
|
||||
PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter;
|
||||
CoCreateInstance(__uuidof(PPTXFile::CAVSOfficeDrawingConverter), NULL, CLSCTX_ALL, __uuidof(PPTXFile::IAVSOfficeDrawingConverter), (void**)(&pOfficeDrawingConverter));
|
||||
|
||||
BSTR bstrFontDir = fontDir.AllocSysString();
|
||||
pOfficeDrawingConverter->SetFontDir(bstrFontDir);
|
||||
SysFreeString(bstrFontDir);
|
||||
VARIANT vt;
|
||||
vt.vt = VT_UNKNOWN;
|
||||
vt.punkVal = pFontPicker;
|
||||
pOfficeDrawingConverter->SetAdditionalParam(_T("FontPicker"), vt);
|
||||
IUnknown* pThis = NULL;
|
||||
this->QueryInterface( __uuidof(IUnknown), (void**)&pThis );
|
||||
pOfficeDrawingConverter->SetMainDocument(pThis);
|
||||
RELEASEINTERFACE(pThis);
|
||||
BSTR bstrMediaDir = mediaDir.AllocSysString();
|
||||
pOfficeDrawingConverter->SetMediaDstPath(bstrMediaDir);
|
||||
SysFreeString(bstrMediaDir);
|
||||
|
||||
m_oBinaryFileWriter = new BinDocxRW::BinaryFileWriter(oBufferedStream, fp, pEmbeddedFontsManager, pOfficeDrawingConverter);
|
||||
m_oBinaryFileWriter->intoBindoc(CString(bsInputDir));
|
||||
|
||||
BYTE* pbBinBuffer = oBufferedStream.GetBuffer();
|
||||
int nBinBufferLen = oBufferedStream.GetPosition();
|
||||
|
||||
if (m_bIsNoBase64Save)
|
||||
{
|
||||
CFile oFile;
|
||||
oFile.CreateFileW(bsFileDst);
|
||||
oFile.WriteFile(pbBinBuffer, nBinBufferLen);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
|
||||
BYTE* pbBase64Buffer = new BYTE[nBase64BufferLen];
|
||||
if(TRUE == Base64::Base64Encode(pbBinBuffer, nBinBufferLen, (LPSTR)pbBase64Buffer, &nBase64BufferLen, Base64::B64_BASE64_FLAG_NOCRLF))
|
||||
{
|
||||
CFile oFile;
|
||||
oFile.CreateFileW(bsFileDst);
|
||||
oFile.WriteStringUTF8(m_oBinaryFileWriter->WriteFileHeader(nBinBufferLen));
|
||||
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
}
|
||||
RELEASEOBJECT(m_oBinaryFileWriter);
|
||||
RELEASEINTERFACE(pFontPicker);
|
||||
RELEASEINTERFACE(pOfficeDrawingConverter);
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHOD(GetJfdoc)(BSTR bsInputDir, BSTR* bsJfdoc)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHOD(SetMediaDir)(BSTR bsMediaDir)
|
||||
{
|
||||
mediaDir = bsMediaDir;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHOD(SetFontDir)(BSTR bsFontDir)
|
||||
{
|
||||
fontDir = bsFontDir;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(SetUseSystemFonts)(BOOL useSystemFonts)
|
||||
{
|
||||
DocWrapper::FontProcessor::useSystemFonts = (useSystemFonts == TRUE);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
|
||||
{
|
||||
CString sParamName; sParamName = ParamName;
|
||||
if (_T("EmbeddedFontsDirectory") == sParamName && ParamValue.vt == VT_BSTR)
|
||||
{
|
||||
m_strEmbeddedFontsDirectory = ParamValue.bstrVal;
|
||||
return S_OK;
|
||||
}
|
||||
else if (_T("FontDir") == sParamName && ParamValue.vt == VT_BSTR)
|
||||
{
|
||||
m_sFontDir = CString(ParamValue.bstrVal);
|
||||
}
|
||||
else if (_T("SaveChartAsImg") == sParamName && ParamValue.vt == VT_BOOL)
|
||||
{
|
||||
m_bSaveChartAsImg = VARIANT_TRUE == ParamValue.boolVal;
|
||||
}
|
||||
else if (_T("NoBase64Save") == sParamName && ParamValue.vt == VT_BOOL)
|
||||
{
|
||||
m_bIsNoBase64Save = (VARIANT_TRUE == ParamValue.boolVal);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHOD(GetBinaryContent)(BSTR bsTxContent, SAFEARRAY** ppBinary)
|
||||
{
|
||||
if(NULL == m_oBinaryFileWriter)
|
||||
return S_FALSE;
|
||||
Streams::CBuffer oBuffer;
|
||||
oBuffer.Create(BUFFER_GROW_SIZE, BUFFER_GROW_SIZE);
|
||||
Streams::CBufferedStream oBufferedStream;
|
||||
oBufferedStream.SetBuffer(&oBuffer);
|
||||
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
oReader.FromString(CString(bsTxContent));
|
||||
oReader.ReadNextNode();
|
||||
CString sRootName = oReader.GetName();
|
||||
if(_T("v:textbox") == sRootName)
|
||||
oReader.ReadNextNode();
|
||||
|
||||
OOX::Logic::CSdtContent oSdtContent;
|
||||
oSdtContent.fromXML(oReader);
|
||||
|
||||
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oBufferedStream, m_oBinaryFileWriter->m_oEmbeddedFontsManager);
|
||||
int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart();
|
||||
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oBufferedStream, m_oBinaryFileWriter->m_oEmbeddedFontsManager, m_oBinaryFileWriter->m_pTheme, m_oBinaryFileWriter->m_pSettings, m_oBinaryFileWriter->m_oFontProcessor, m_oBinaryFileWriter->m_pCurRels, m_oBinaryFileWriter->m_pOfficeDrawingConverter, NULL);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(oSdtContent.m_arrItems);
|
||||
oBinaryCommonWriter.WriteItemWithLengthEnd(nCurPos);
|
||||
|
||||
if (NULL != ppBinary)
|
||||
{
|
||||
long lBinarySize = oBufferedStream.GetPosition();
|
||||
SAFEARRAYBOUND rgsabound[1];
|
||||
rgsabound[0].lLbound = 0;
|
||||
rgsabound[0].cElements = lBinarySize;
|
||||
LPSAFEARRAY pArray = SafeArrayCreate(VT_UI1, 1, rgsabound);
|
||||
|
||||
BYTE* pDataD = (BYTE*)pArray->pvData;
|
||||
BYTE* pDataS = oBufferedStream.GetBuffer();
|
||||
memcpy(pDataD, pDataS, lBinarySize);
|
||||
|
||||
*ppBinary = pArray;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHOD(Write)(BSTR bstrFileIn, BSTR bstrDirectoryOut)
|
||||
{
|
||||
bool bResultOk = false;
|
||||
MemoryMapping::CMappingFile oMappingFile = MemoryMapping::CMappingFile();
|
||||
if(FALSE != oMappingFile.Open(CString(bstrFileIn)))
|
||||
{
|
||||
long nBase64DataSize = oMappingFile.GetSize();
|
||||
BYTE* pBase64Data = oMappingFile.GetData();
|
||||
|
||||
|
||||
bool bValidFormat = false;
|
||||
CString sSignature(BinDocxRW::g_sFormatSignature);
|
||||
int nSigLength = sSignature.GetLength();
|
||||
if(nBase64DataSize > nSigLength)
|
||||
{
|
||||
CStringA sCurSig((char*)pBase64Data, nSigLength);
|
||||
if((CStringA)sSignature == sCurSig)
|
||||
{
|
||||
bValidFormat = true;
|
||||
}
|
||||
}
|
||||
if(bValidFormat)
|
||||
{
|
||||
|
||||
int nIndex = nSigLength;
|
||||
int nType = 0;
|
||||
CStringA version = "";
|
||||
CStringA dst_len = "";
|
||||
while (true)
|
||||
{
|
||||
nIndex++;
|
||||
BYTE _c = pBase64Data[nIndex];
|
||||
if (_c == ';')
|
||||
{
|
||||
|
||||
if(0 == nType)
|
||||
{
|
||||
nType = 1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
nIndex++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(0 == nType)
|
||||
version.AppendChar(_c);
|
||||
else
|
||||
dst_len.AppendChar(_c);
|
||||
}
|
||||
int nDataSize = atoi(dst_len);
|
||||
|
||||
SAFEARRAYBOUND rgsabound[1];
|
||||
rgsabound[0].lLbound = 0;
|
||||
rgsabound[0].cElements = nDataSize;
|
||||
LPSAFEARRAY pArray = SafeArrayCreate(VT_UI1, 1, rgsabound);
|
||||
if(FALSE != Base64::Base64Decode((LPCSTR)(pBase64Data + nIndex), nBase64DataSize - nIndex, (BYTE*)pArray->pvData, &nDataSize))
|
||||
{
|
||||
Streams::CBuffer oBuffer;
|
||||
Streams::CBufferedStream oBufferedStream;
|
||||
oBufferedStream.SetBuffer(&oBuffer);
|
||||
oBufferedStream.Create((BYTE*)pArray->pvData, nDataSize);
|
||||
|
||||
CString sDirectoryOut = CString(bstrDirectoryOut);
|
||||
CString sThemePath;
|
||||
CString sMediaPath;
|
||||
CreateDocument(sDirectoryOut, sThemePath, sMediaPath);
|
||||
|
||||
int nVersion = BinDocxRW::g_nFormatVersion;
|
||||
if(version.GetLength() > 0)
|
||||
{
|
||||
version = version.Right(version.GetLength() - 1);
|
||||
int nTempVersion = atoi(version);
|
||||
if(0 != nTempVersion)
|
||||
nVersion = nTempVersion;
|
||||
}
|
||||
PPTXFile::IAVSOfficeDrawingConverter* pDrawingConverter = NULL;
|
||||
CoCreateInstance(__uuidof(PPTXFile::CAVSOfficeDrawingConverter), NULL, CLSCTX_ALL, __uuidof(PPTXFile::IAVSOfficeDrawingConverter), (void**) &pDrawingConverter);
|
||||
IUnknown* pThis = NULL;
|
||||
this->QueryInterface( __uuidof(IUnknown), (void**)&pThis );
|
||||
pDrawingConverter->SetMainDocument(pThis);
|
||||
RELEASEINTERFACE(pThis);
|
||||
BSTR bstrMediaPath = sMediaPath.AllocSysString();
|
||||
pDrawingConverter->SetMediaDstPath(bstrMediaPath);
|
||||
SysFreeString(bstrMediaPath);
|
||||
m_pCurFileWriter = new Writers::FileWriter(sDirectoryOut, m_sFontDir, nVersion, m_bSaveChartAsImg, pDrawingConverter, pArray, sThemePath);
|
||||
|
||||
|
||||
TCHAR tFolder[256];
|
||||
TCHAR tDrive[256];
|
||||
_tsplitpath( bstrFileIn, tDrive, tFolder, NULL, NULL );
|
||||
CString sFolder = CString(tFolder);
|
||||
CString sDrive = CString(tDrive);
|
||||
CString sFileInDir = sDrive + sFolder;
|
||||
|
||||
VARIANT var;
|
||||
var.vt = VT_BSTR;
|
||||
var.bstrVal = sFileInDir.AllocSysString();
|
||||
pDrawingConverter->SetAdditionalParam(L"SourceFileDir", var);
|
||||
RELEASESYSSTRING(var.bstrVal);
|
||||
|
||||
BinaryFileReader oBinaryFileReader(sFileInDir, oBufferedStream, *m_pCurFileWriter);
|
||||
oBinaryFileReader.ReadFile();
|
||||
|
||||
if(NULL != pDrawingConverter)
|
||||
{
|
||||
VARIANT vt;
|
||||
pDrawingConverter->GetAdditionalParam(_T("ContentTypes"), &vt);
|
||||
if(VT_BSTR == vt.vt)
|
||||
m_pCurFileWriter->m_oContentTypesWriter.AddOverrideRaw(CString(vt.bstrVal));
|
||||
}
|
||||
|
||||
m_pCurFileWriter->m_oCommentsWriter.Write();
|
||||
m_pCurFileWriter->m_oChartWriter.Write();
|
||||
m_pCurFileWriter->m_oStylesWriter.Write();
|
||||
m_pCurFileWriter->m_oNumberingWriter.Write();
|
||||
m_pCurFileWriter->m_oFontTableWriter.Write();
|
||||
m_pCurFileWriter->m_oHeaderFooterWriter.Write();
|
||||
|
||||
m_pCurFileWriter->m_oSettingWriter.Write();
|
||||
|
||||
m_pCurFileWriter->m_oDocumentWriter.Write();
|
||||
|
||||
|
||||
m_pCurFileWriter->m_oContentTypesWriter.Write();
|
||||
|
||||
|
||||
|
||||
|
||||
bResultOk = true;
|
||||
|
||||
RELEASEINTERFACE(pDrawingConverter);
|
||||
}
|
||||
RELEASEARRAY(pArray);
|
||||
}
|
||||
oMappingFile.Close();
|
||||
}
|
||||
return bResultOk ? S_OK : S_FALSE;
|
||||
}
|
||||
STDMETHOD(GetXmlContent)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, BSTR* bsXml)
|
||||
{
|
||||
Streams::CBuffer oBuffer;
|
||||
Streams::CBufferedStream oBufferedStream;
|
||||
oBufferedStream.SetBuffer(&oBuffer);
|
||||
oBufferedStream.Create((BYTE*)pBinaryObj->pvData, pBinaryObj->rgsabound[0].cElements);
|
||||
|
||||
oBufferedStream.Seek(lStart);
|
||||
long nLength = oBufferedStream.ReadLong();
|
||||
|
||||
Writers::ContentWriter oTempContentWriter;
|
||||
Binary_DocumentTableReader oBinary_DocumentTableReader(oBufferedStream, *m_pCurFileWriter, oTempContentWriter, NULL);
|
||||
int res = oBinary_DocumentTableReader.Read1(nLength, &Binary_DocumentTableReader::ReadDocumentContent, &oBinary_DocumentTableReader, NULL);
|
||||
|
||||
(*bsXml) = oTempContentWriter.m_oContent.GetData().AllocSysString();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
private:
|
||||
void CreateDocument(CString strDirectory, CString& sThemePath, CString& sMediaPath)
|
||||
{
|
||||
HINSTANCE hInst = _AtlBaseModule.GetModuleInstance();
|
||||
|
||||
|
||||
CString strRels = strDirectory + _T("\\_rels");
|
||||
CreateDirectory(strRels, NULL);
|
||||
|
||||
LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_DEFAULT_DOC_RELS), _T("DOCXWR"), strRels + _T("\\.rels"));
|
||||
|
||||
|
||||
|
||||
|
||||
CString strDocProps = strDirectory + _T("\\docProps");
|
||||
CreateDirectory(strDocProps, NULL);
|
||||
|
||||
LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_DEFAULT_DOC_APP), _T("DOCXWR"), strDocProps + _T("\\app.xml"));
|
||||
LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_DEFAULT_DOC_CORE), _T("DOCXWR"), strDocProps + _T("\\core.xml"));
|
||||
|
||||
|
||||
CString strWord = strDirectory + _T("\\word");
|
||||
CreateDirectory(strWord, NULL);
|
||||
|
||||
sMediaPath = strWord + _T("\\media");
|
||||
|
||||
|
||||
LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_DEFAULT_DOC_WEBSETTINGS), _T("DOCXWR"), strWord + _T("\\webSettings.xml"));
|
||||
|
||||
|
||||
CString strTheme = strWord + _T("\\theme");
|
||||
CreateDirectory(strTheme, NULL);
|
||||
sThemePath = strTheme + _T("\\theme1.xml");
|
||||
LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_DEFAULT_DOC_THEME), _T("DOCXWR"), sThemePath);
|
||||
|
||||
|
||||
CreateDirectory(strWord + _T("\\_rels"), NULL);
|
||||
}
|
||||
void LoadResourceFile(HINSTANCE hInst, LPCTSTR sResName, LPCTSTR sResType, const CString& strDstFile)
|
||||
{
|
||||
HRSRC hrRes = FindResource(hInst, sResName, sResType);
|
||||
if (!hrRes)
|
||||
return;
|
||||
|
||||
HGLOBAL hGlobal = LoadResource(hInst, hrRes);
|
||||
DWORD sz = SizeofResource(hInst, hrRes);
|
||||
void* ptrRes = LockResource(hGlobal);
|
||||
|
||||
CFile oFile;
|
||||
oFile.CreateFile(strDstFile);
|
||||
oFile.WriteFile(ptrRes, sz);
|
||||
|
||||
UnlockResource(hGlobal);
|
||||
FreeResource(hGlobal);
|
||||
}
|
||||
};
|
||||
170
ActiveX/ASCOfficeDocxFile2/Foreign/StringWriter.h
Normal file
170
ActiveX/ASCOfficeDocxFile2/Foreign/StringWriter.h
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/File.h"
|
||||
|
||||
static wchar_t g_wc_amp = wchar_t('&');
|
||||
static wchar_t g_wc_apos = wchar_t('\'');
|
||||
static wchar_t g_wc_lt = wchar_t('<');
|
||||
static wchar_t g_wc_qt = wchar_t('>');
|
||||
static wchar_t g_wc_quot = wchar_t('\"');
|
||||
|
||||
static _bstr_t g_bstr_amp = L"&";
|
||||
static _bstr_t g_bstr_apos = L"'";
|
||||
static _bstr_t g_bstr_lt = L"<";
|
||||
static _bstr_t g_bstr_qt = L">";
|
||||
static _bstr_t g_bstr_quot = L"\"";
|
||||
static _bstr_t g_bstr_mdash = L"—";
|
||||
|
||||
namespace NSCommon
|
||||
{
|
||||
class CStringWriter
|
||||
{
|
||||
private:
|
||||
wchar_t* m_pData;
|
||||
size_t m_lSize;
|
||||
|
||||
wchar_t* m_pDataCur;
|
||||
size_t m_lSizeCur;
|
||||
|
||||
public:
|
||||
CStringWriter()
|
||||
{
|
||||
m_pData = NULL;
|
||||
m_lSize = 0;
|
||||
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = m_lSize;
|
||||
}
|
||||
~CStringWriter()
|
||||
{
|
||||
RELEASEMEM(m_pData);
|
||||
}
|
||||
|
||||
__forceinline void AddSize(size_t nSize, const size_t nSizeMin = 1000)
|
||||
{
|
||||
if (NULL == m_pData)
|
||||
{
|
||||
m_lSize = max(nSize, nSizeMin);
|
||||
m_pData = (wchar_t*)malloc(m_lSize * sizeof(wchar_t));
|
||||
|
||||
m_lSizeCur = 0;
|
||||
m_pDataCur = m_pData;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((m_lSizeCur + nSize) > m_lSize)
|
||||
{
|
||||
while ((m_lSizeCur + nSize) > m_lSize)
|
||||
{
|
||||
m_lSize *= 2;
|
||||
}
|
||||
|
||||
wchar_t* pRealloc = (wchar_t*)realloc(m_pData, m_lSize * sizeof(wchar_t));
|
||||
if (NULL != pRealloc)
|
||||
{
|
||||
|
||||
m_pData = pRealloc;
|
||||
m_pDataCur = m_pData + m_lSizeCur;
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t* pMalloc = (wchar_t*)malloc(m_lSize * sizeof(wchar_t));
|
||||
memcpy(pMalloc, m_pData, m_lSizeCur * sizeof(wchar_t));
|
||||
|
||||
free(m_pData);
|
||||
m_pData = pMalloc;
|
||||
m_pDataCur = m_pData + m_lSizeCur;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
inline void WriteString(wchar_t* pString, size_t& nLen)
|
||||
{
|
||||
AddSize(nLen);
|
||||
|
||||
memcpy(m_pDataCur, pString, nLen << 1);
|
||||
m_pDataCur += nLen;
|
||||
m_lSizeCur += nLen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline void WriteString(CString& sString)
|
||||
{
|
||||
size_t nLen = (size_t)sString.GetLength();
|
||||
|
||||
#ifdef _UNICODE
|
||||
WriteString(sString.GetBuffer(), nLen);
|
||||
#else
|
||||
CStringW str = (CStringW)sString;
|
||||
WriteString(str.GetBuffer(), nLen);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline size_t GetCurSize()
|
||||
{
|
||||
return m_lSizeCur;
|
||||
}
|
||||
|
||||
inline void Write(CStringWriter& oWriter)
|
||||
{
|
||||
WriteString(oWriter.m_pData, oWriter.m_lSizeCur);
|
||||
}
|
||||
|
||||
inline void Clear()
|
||||
{
|
||||
RELEASEMEM(m_pData);
|
||||
|
||||
m_pData = NULL;
|
||||
m_lSize = 0;
|
||||
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = 0;
|
||||
}
|
||||
inline void ClearNoAttack()
|
||||
{
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = 0;
|
||||
}
|
||||
|
||||
CString GetData()
|
||||
{
|
||||
CString str(m_pData, (int)m_lSizeCur);
|
||||
return str;
|
||||
}
|
||||
};
|
||||
}
|
||||
23
ActiveX/ASCOfficeDocxFile2/Resource.h
Normal file
23
ActiveX/ASCOfficeDocxFile2/Resource.h
Normal file
@@ -0,0 +1,23 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by AVSOfficeDocxFile2.rc
|
||||
//
|
||||
#define IDS_PROJNAME 100
|
||||
#define IDR_ASCOFFICEDOCXFILE2 101
|
||||
|
||||
#define IDB_DEFAULT_DOC_RELS 201
|
||||
#define IDB_DEFAULT_DOC_APP 202
|
||||
#define IDB_DEFAULT_DOC_CORE 203
|
||||
#define IDB_DEFAULT_DOC_THEME 204
|
||||
#define IDB_DEFAULT_DOC_WEBSETTINGS 205
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 401
|
||||
#define _APS_NEXT_COMMAND_VALUE 32768
|
||||
#define _APS_NEXT_CONTROL_VALUE 201
|
||||
#define _APS_NEXT_SYMED_VALUE 102
|
||||
#endif
|
||||
#endif
|
||||
1
ActiveX/ASCOfficeDocxFile2/Resources/.rels
Normal file
1
ActiveX/ASCOfficeDocxFile2/Resources/.rels
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/></Relationships>
|
||||
1
ActiveX/ASCOfficeDocxFile2/Resources/[Content_Types].xml
Normal file
1
ActiveX/ASCOfficeDocxFile2/Resources/[Content_Types].xml
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Default Extension="png" ContentType="image/png"/><Default Extension="jpg" ContentType="image/jpg"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/><Override PartName="/word/webSettings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"/><Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"/><Override PartName="/word/theme/theme.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>
|
||||
1
ActiveX/ASCOfficeDocxFile2/Resources/app.xml
Normal file
1
ActiveX/ASCOfficeDocxFile2/Resources/app.xml
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"><Template>Normal.dotm</Template><TotalTime>1</TotalTime><Pages>1</Pages><Words>0</Words><Characters>0</Characters><Application>Teamlab Office Word</Application><DocSecurity>0</DocSecurity><Lines>1</Lines><Paragraphs>1</Paragraphs><ScaleCrop>false</ScaleCrop><Company>Ascensio System</Company><LinksUpToDate>false</LinksUpToDate><CharactersWithSpaces>0</CharactersWithSpaces><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>2.0000</AppVersion></Properties>
|
||||
1
ActiveX/ASCOfficeDocxFile2/Resources/core.xml
Normal file
1
ActiveX/ASCOfficeDocxFile2/Resources/core.xml
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:title/><dc:subject/><dc:creator/><cp:keywords/><dc:description/><cp:lastModifiedBy/><cp:revision>1</cp:revision></cp:coreProperties>
|
||||
1
ActiveX/ASCOfficeDocxFile2/Resources/theme.xml
Normal file
1
ActiveX/ASCOfficeDocxFile2/Resources/theme.xml
Normal file
File diff suppressed because one or more lines are too long
1
ActiveX/ASCOfficeDocxFile2/Resources/webSettings.xml
Normal file
1
ActiveX/ASCOfficeDocxFile2/Resources/webSettings.xml
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><w:webSettings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:optimizeForBrowser/></w:webSettings>
|
||||
40
ActiveX/ASCOfficeDocxFile2/dlldata.c
Normal file
40
ActiveX/ASCOfficeDocxFile2/dlldata.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*********************************************************
|
||||
DllData file -- generated by MIDL compiler
|
||||
|
||||
DO NOT ALTER THIS FILE
|
||||
|
||||
This file is regenerated by MIDL on every IDL file compile.
|
||||
|
||||
To completely reconstruct this file, delete it and rerun MIDL
|
||||
on all the IDL files in this DLL, specifying this file for the
|
||||
/dlldata command line option
|
||||
|
||||
*********************************************************/
|
||||
|
||||
#define PROXY_DELEGATION
|
||||
|
||||
#include <rpcproxy.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
EXTERN_PROXY_FILE( _ASCOfficeDocxFile2 )
|
||||
EXTERN_PROXY_FILE( _AVSOfficeDocxFile2 )
|
||||
|
||||
|
||||
PROXYFILE_LIST_START
|
||||
/* Start of list */
|
||||
REFERENCE_PROXY_FILE( _ASCOfficeDocxFile2 ),
|
||||
REFERENCE_PROXY_FILE( _AVSOfficeDocxFile2 ),
|
||||
/* End of list */
|
||||
PROXYFILE_LIST_END
|
||||
|
||||
|
||||
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
/* end of generated dlldata file */
|
||||
5
ActiveX/ASCOfficeDocxFile2/stdafx.cpp
Normal file
5
ActiveX/ASCOfficeDocxFile2/stdafx.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// AVSOfficeDocxFile2.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
82
ActiveX/ASCOfficeDocxFile2/stdafx.h
Normal file
82
ActiveX/ASCOfficeDocxFile2/stdafx.h
Normal file
@@ -0,0 +1,82 @@
|
||||
// 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 _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#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 <windows.h>
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <atlcom.h>
|
||||
#include <atlwin.h>
|
||||
#include <atltypes.h>
|
||||
#include <atlctl.h>
|
||||
#include <atlhost.h>
|
||||
#include <atlcoll.h>
|
||||
|
||||
using namespace ATL;
|
||||
#include "../Common/ASCUtils.h"
|
||||
#include "../Common/Config.h"
|
||||
|
||||
#include <Gdiplus.h>
|
||||
#pragma comment(lib, "gdiplus.lib")
|
||||
|
||||
using namespace Gdiplus;
|
||||
|
||||
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
|
||||
|
||||
#import "../Redist/OfficeCore.dll" named_guids raw_interfaces_only rename_namespace("OfficeCore")
|
||||
|
||||
#ifndef _DEFINE_NAMESPACE_ASC_GRAPHICS_
|
||||
#define _DEFINE_NAMESPACE_ASC_GRAPHICS_
|
||||
namespace ASCGraphics
|
||||
{
|
||||
typedef OfficeCore::IWinFonts IASCFontManager;
|
||||
const GUID CLSID_CASCFontManager = OfficeCore::CLSID_CWinFonts;
|
||||
const GUID IID_IASCFontManager = OfficeCore::IID_IWinFonts;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#import "../Redist/ASCGraphics.dll" named_guids raw_interfaces_only rename_namespace("ASCGraphics")
|
||||
#import "../Redist/ASCFontConverter.dll" named_guids raw_interfaces_only rename_namespace("Fonts")
|
||||
|
||||
#endif
|
||||
|
||||
#import "../Redist/ASCOfficePPTXFile.dll" named_guids raw_interfaces_only rename_namespace("PPTXFile"), exclude("_IAVSOfficeFileTemplateEvents"), exclude("_IAVSOfficeFileTemplateEvents2"), exclude("IASCRenderer")
|
||||
|
||||
#include "../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
|
||||
|
||||
8
ActiveX/ASCOfficeDocxFile2/stdafx2.h
Normal file
8
ActiveX/ASCOfficeDocxFile2/stdafx2.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include "WritingElement.h"
|
||||
#include "Docx.h"
|
||||
#include "DocMeasurer/FontProcessor.h"
|
||||
#include "Docx.h"
|
||||
7
ActiveX/ASCOfficeDocxFile2/version.h
Normal file
7
ActiveX/ASCOfficeDocxFile2/version.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
//2
|
||||
//0
|
||||
//0
|
||||
//160
|
||||
#define INTVER 2,0,0,160
|
||||
#define STRVER "2,0,0,160\0"
|
||||
Reference in New Issue
Block a user