prepare additional abstraction layer for OLE Compound Document files

This commit is contained in:
Michael Becker 2022-04-16 11:46:11 -04:00
parent 738571b1e6
commit dc9a02e131
No known key found for this signature in database
GPG Key ID: DA394832305DA332
7 changed files with 84 additions and 12 deletions

View File

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using UniversalEditor.DataFormats.FileSystem.Microsoft.CompoundDocument;
using UniversalEditor.Plugins.Genealogy.ObjectModels.FamilyTree;
using UniversalEditor.ObjectModels.FileSystem;
using UniversalEditor.DataFormats.CompoundDocument;
using UniversalEditor.ObjectModels.CompoundDocument;
namespace UniversalEditor.Plugins.Genealogy.DataFormats.FamilyTreeMaker.Windows
{
@ -22,13 +24,13 @@ namespace UniversalEditor.Plugins.Genealogy.DataFormats.FamilyTreeMaker.Windows
protected override void BeforeLoadInternal (Stack<ObjectModel> objectModels)
{
base.BeforeLoadInternal (objectModels);
objectModels.Push (new FileSystemObjectModel ());
objectModels.Push (new CompoundDocumentObjectModel ());
}
protected override void AfterLoadInternal (Stack<ObjectModel> objectModels)
{
base.AfterLoadInternal (objectModels);
FileSystemObjectModel fsom = (objectModels.Pop () as FileSystemObjectModel);
CompoundDocumentObjectModel fsom = (objectModels.Pop () as CompoundDocumentObjectModel);
File IND_DB = fsom.Files["IND.DB"];
File INDGROUPS = fsom.Files["QEDIT0.DB"];
@ -59,7 +61,7 @@ namespace UniversalEditor.Plugins.Genealogy.DataFormats.FamilyTreeMaker.Windows
protected override void BeforeSaveInternal (Stack<ObjectModel> objectModels)
{
FamilyTreeObjectModel ft = (objectModels.Pop() as FamilyTreeObjectModel);
FileSystemObjectModel fsom = new FileSystemObjectModel();
CompoundDocumentObjectModel fsom = new CompoundDocumentObjectModel();
objectModels.Push(fsom);

View File

@ -20,7 +20,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Collections.Generic;
using UniversalEditor.DataFormats.CompoundDocument;
using UniversalEditor.DataFormats.FileSystem.Microsoft.CompoundDocument;
using UniversalEditor.ObjectModels.CompoundDocument;
using UniversalEditor.ObjectModels.FileSystem;
using UniversalEditor.ObjectModels.PropertyList;
@ -45,12 +47,12 @@ namespace UniversalEditor.DataFormats.PropertyList.Microsoft.VisualStudio
protected override void BeforeLoadInternal(Stack<ObjectModel> objectModels)
{
base.BeforeLoadInternal(objectModels);
objectModels.Push(new FileSystemObjectModel());
objectModels.Push(new CompoundDocumentObjectModel());
}
protected override void AfterLoadInternal(Stack<ObjectModel> objectModels)
{
base.AfterLoadInternal(objectModels);
FileSystemObjectModel fsom = (objectModels.Pop() as FileSystemObjectModel);
CompoundDocumentObjectModel fsom = (objectModels.Pop() as CompoundDocumentObjectModel);
PropertyListObjectModel plom = (objectModels.Pop() as PropertyListObjectModel);
for (int i = 0; i < fsom.Files.Count; i++ )
@ -61,7 +63,7 @@ namespace UniversalEditor.DataFormats.PropertyList.Microsoft.VisualStudio
base.BeforeSaveInternal(objectModels);
PropertyListObjectModel plom = (objectModels.Pop() as PropertyListObjectModel);
FileSystemObjectModel fsom = new FileSystemObjectModel();
CompoundDocumentObjectModel fsom = new CompoundDocumentObjectModel();

View File

@ -0,0 +1,30 @@
//
// CompoundDocumentDataFormat.cs
//
// Author:
// Michael Becker <alcexhim@gmail.com>
//
// Copyright (c) 2022 Mike Becker's Software
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using UniversalEditor.DataFormats.FileSystem.Microsoft.CompoundDocument;
namespace UniversalEditor.DataFormats.CompoundDocument
{
public class CompoundDocumentDataFormat : CompoundDocumentBaseDataFormat
{
}
}

View File

@ -32,7 +32,7 @@ namespace UniversalEditor.DataFormats.FileSystem.Microsoft.CompoundDocument
/// <see cref="DataFormat" />s that manipulate files based on the Microsoft Compound Document Format specification, such as those from older
/// versions of Microsoft Office.
/// </summary>
public class CompoundDocumentDataFormat : DataFormat
public class CompoundDocumentBaseDataFormat : DataFormat
{
private static DataFormatReference _dfr;
protected override DataFormatReference MakeReferenceInternal()

View File

@ -20,7 +20,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Collections.Generic;
using UniversalEditor.DataFormats.CompoundDocument;
using UniversalEditor.DataFormats.FileSystem.Microsoft.CompoundDocument;
using UniversalEditor.ObjectModels.CompoundDocument;
using UniversalEditor.ObjectModels.FileSystem;
using UniversalEditor.ObjectModels.Text.Formatted;
@ -45,20 +47,20 @@ namespace UniversalEditor.DataFormats.Text.Formatted.DOC
protected override void BeforeLoadInternal(Stack<ObjectModel> objectModels)
{
base.BeforeLoadInternal(objectModels);
objectModels.Push(new FileSystemObjectModel());
objectModels.Push(new CompoundDocumentObjectModel());
}
protected override void AfterLoadInternal(Stack<ObjectModel> objectModels)
{
base.AfterLoadInternal(objectModels);
FileSystemObjectModel fsom = (objectModels.Pop() as FileSystemObjectModel);
CompoundDocumentObjectModel fsom = (objectModels.Pop() as CompoundDocumentObjectModel);
FormattedTextObjectModel ftom = (objectModels.Pop() as FormattedTextObjectModel);
}
protected override void BeforeSaveInternal(Stack<ObjectModel> objectModels)
{
FormattedTextObjectModel ftom = (objectModels.Pop() as FormattedTextObjectModel);
FileSystemObjectModel fsom = new FileSystemObjectModel();
CompoundDocumentObjectModel fsom = new CompoundDocumentObjectModel();

View File

@ -0,0 +1,32 @@
//
// CompoundDocumentObjectModel.cs
//
// Author:
// Michael Becker <alcexhim@gmail.com>
//
// Copyright (c) 2022 Mike Becker's Software
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using UniversalEditor.ObjectModels.FileSystem;
namespace UniversalEditor.ObjectModels.CompoundDocument
{
public class CompoundDocumentObjectModel : FileSystemObjectModel
{
public CompoundDocumentObjectModel()
{
}
}
}

View File

@ -44,7 +44,7 @@
<Compile Include="DataFormats\FileSystem\Microsoft\Cabinet\CABCompressionMethod.cs" />
<Compile Include="DataFormats\FileSystem\Microsoft\Cabinet\CABDataFormat.cs" />
<Compile Include="DataFormats\FileSystem\Microsoft\Cabinet\CABFlags.cs" />
<Compile Include="DataFormats\FileSystem\Microsoft\CompoundDocument\CompoundDocumentDataFormat.cs" />
<Compile Include="DataFormats\FileSystem\Microsoft\CompoundDocument\CompoundDocumentBaseDataFormat.cs" />
<Compile Include="DataFormats\FileSystem\Microsoft\CompoundDocument\CompoundDocumentKnownSectorID.cs" />
<Compile Include="DataFormats\FileSystem\Microsoft\MSCompressed\MSCompressedCompressionMethod.cs" />
<Compile Include="DataFormats\FileSystem\Microsoft\MSCompressed\MSCompressedDataFormat.cs" />
@ -147,6 +147,8 @@
<Compile Include="DataFormats\FileSystem\Microsoft\NTFS\Attributes\NTFSStandardInformationAttribute.cs" />
<Compile Include="DataFormats\FileSystem\Microsoft\NTFS\Attributes\NTFSDataAttribute.cs" />
<Compile Include="DataFormats\FileSystem\Microsoft\MSCompressed\Internal\SZDDComp.cs" />
<Compile Include="DataFormats\CompoundDocument\CompoundDocumentDataFormat.cs" />
<Compile Include="ObjectModels\CompoundDocument\CompoundDocumentObjectModel.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Libraries\UniversalEditor.Compression\UniversalEditor.Compression.csproj">
@ -203,6 +205,8 @@
<Folder Include="Associations\Help\" />
<Folder Include="Associations\Text\" />
<Folder Include="Associations\Text\Formatted\" />
<Folder Include="DataFormats\CompoundDocument\" />
<Folder Include="ObjectModels\CompoundDocument\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Associations\Help\WinHelp.uexml" />