Start to implement XPS format... not complete
This commit is contained in:
parent
72b4772138
commit
40624f91d2
@ -0,0 +1,98 @@
|
||||
//
|
||||
// XPSDataFormat.cs
|
||||
//
|
||||
// Author:
|
||||
// beckermj <${AuthorEmail}>
|
||||
//
|
||||
// Copyright (c) 2014 beckermj
|
||||
//
|
||||
// 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.ZIP;
|
||||
using UniversalEditor.ObjectModels.FileSystem;
|
||||
|
||||
namespace UniversalEditor
|
||||
{
|
||||
public class XPSDataFormat : ZIPDataFormat
|
||||
{
|
||||
private static DataFormatReference _dfr = null;
|
||||
public override DataFormatReference MakeReference()
|
||||
{
|
||||
if (_dfr == null)
|
||||
{
|
||||
_dfr = new DataFormatReference(GetType());
|
||||
// _dfr.Capabilities.Add(typeof(FormattedTextObjectModel), DataFormatCapabilities.All);
|
||||
_dfr.Filters.Add("Microsoft XPS document", new string[] { "*.xps", "*.oxps" });
|
||||
}
|
||||
return _dfr;
|
||||
}
|
||||
|
||||
protected override void BeforeLoadInternal(System.Collections.Generic.Stack<ObjectModel> objectModels)
|
||||
{
|
||||
objectModels.Push(new FileSystemObjectModel());
|
||||
}
|
||||
protected override void AfterLoadInternal(System.Collections.Generic.Stack<ObjectModel> objectModels)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModels.Pop() as FileSystemObjectModel);
|
||||
FormattedTextObjectModel text = (objectModels.Pop() as FormattedTextObjectModel);
|
||||
}
|
||||
|
||||
protected override void BeforeSaveInternal(System.Collections.Generic.Stack<ObjectModel> objectModels)
|
||||
{
|
||||
// FormattedTextObjectModel text = (objectModels.Pop() as FormattedTextObjectModel);
|
||||
|
||||
FileSystemObjectModel fsom = new FileSystemObjectModel();
|
||||
|
||||
#region _rels
|
||||
{
|
||||
Folder fldr = new Folder();
|
||||
fldr.Name = "_rels";
|
||||
fsom.Folders.Add(fldr);
|
||||
}
|
||||
#endregion
|
||||
#region Documents
|
||||
{
|
||||
Folder fldr = new Folder();
|
||||
fldr.Name = "Documents";
|
||||
fsom.Folders.Add(fldr);
|
||||
}
|
||||
#endregion
|
||||
#region Metadata
|
||||
{
|
||||
Folder fldr = new Folder();
|
||||
fldr.Name = "Metadata";
|
||||
fsom.Folders.Add(fldr);
|
||||
}
|
||||
#endregion
|
||||
#region [Content_Types].xml
|
||||
{
|
||||
File file = new File();
|
||||
file.Name = "[Content_Types].xml";
|
||||
fsom.Files.Add(file);
|
||||
}
|
||||
#endregion
|
||||
#region FixedDocumentSequence.fdseq
|
||||
{
|
||||
File file = new File();
|
||||
file.Name = "FixedDocumentSequence.fdseq";
|
||||
fsom.Files.Add(file);
|
||||
}
|
||||
#endregion
|
||||
|
||||
objectModels.Push(fsom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@
|
||||
<Compile Include="DataFormats\Shortcut\Microsoft\LNKLocationFlags.cs" />
|
||||
<Compile Include="DataFormats\Shortcut\Microsoft\LNKWindowState.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="DataFormats\Text\Formatted\XPS\XPSDataFormat.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
@ -58,6 +59,10 @@
|
||||
<Project>{30467E5C-05BC-4856-AADC-13906EF4CADD}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\UniversalEditor.Plugins.FileSystem\UniversalEditor.Plugins.FileSystem.csproj">
|
||||
<Project>{76FD1306-9CA4-428F-993B-B7E4EEEACBF3}</Project>
|
||||
<Name>UniversalEditor.Plugins.FileSystem</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
@ -68,4 +73,13 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Folder Include="DataFormats\Text\" />
|
||||
<Folder Include="DataFormats\Text\Formatted\" />
|
||||
<Folder Include="DataFormats\Text\Formatted\XPS\" />
|
||||
<Folder Include="ObjectModels\" />
|
||||
<Folder Include="ObjectModels\Text\" />
|
||||
<Folder Include="ObjectModels\Text\Formatted\" />
|
||||
<Folder Include="ObjectModels\Text\Formatted\XPS\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
x
Reference in New Issue
Block a user