diff --git a/gimp/d.xcf b/gimp/d.xcf new file mode 100644 index 0000000..e6402aa Binary files /dev/null and b/gimp/d.xcf differ diff --git a/zaaReloaded2/Demo/Demo.cs b/zaaReloaded2/Demo/Demo.cs new file mode 100755 index 0000000..54e9478 --- /dev/null +++ b/zaaReloaded2/Demo/Demo.cs @@ -0,0 +1,75 @@ +/* Demo.cs + * part of zaaReloaded2 + * + * Copyright 2015 Daniel Kraus + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Microsoft.Office.Interop.Word; + +namespace zaaReloaded2.Demo +{ + /// + /// Static class that serves to load an embedded Word document + /// into a temporary file and open that temporary file in Word. + /// + static class Demo + { + #region Public methods + + /// + /// Opens a demo document. The document's Saved property is set to + /// false so that a user who wants to save changes will be prompted + /// for a file name. + /// + public static void OpenDemoDocument() + { + string tempFile = CreateTempFileFromResource(); + Document demoDoc = Globals.ThisAddIn.Application.Documents + .Add(Template: tempFile); + File.Delete(tempFile); + } + + #endregion + + #region Private methods + + /// + /// Copies the built-in demo file from a resource stream to a + /// temporary file and returns the path to that file. + /// + /// Path to the newly created temporary file. + static string CreateTempFileFromResource() + { + string resourceName = "zaaReloaded2.Demo.Demo.docx"; + Stream resourceStream = typeof(Demo).Assembly + .GetManifestResourceStream(resourceName); + if (resourceStream == null) + { + throw new IOException("Unable to open stream " + resourceName); + } + string fileName = Path.GetTempFileName() + ".docx"; + Stream tempStream = File.Create(fileName); + resourceStream.CopyTo(tempStream); + tempStream.Close(); + return fileName; + } + + #endregion + } +} diff --git a/zaaReloaded2/Demo/Demo.docx b/zaaReloaded2/Demo/Demo.docx new file mode 100755 index 0000000..6164d7b Binary files /dev/null and b/zaaReloaded2/Demo/Demo.docx differ diff --git a/zaaReloaded2/Icons/d.png b/zaaReloaded2/Icons/d.png new file mode 100644 index 0000000..850496d Binary files /dev/null and b/zaaReloaded2/Icons/d.png differ diff --git a/zaaReloaded2/Ribbon.cs b/zaaReloaded2/Ribbon.cs index a9a1791..9e71ff3 100755 --- a/zaaReloaded2/Ribbon.cs +++ b/zaaReloaded2/Ribbon.cs @@ -95,6 +95,9 @@ namespace zaaReloaded2 Globals.ThisAddIn.Application.ActiveDocument, Globals.ThisAddIn.Application.Selection); break; + case "zrlDemo": + Demo.Demo.OpenDemoDocument(); + break; default: throw new InvalidOperationException("No operation defined for " + control.Id); } diff --git a/zaaReloaded2/Ribbon.xml b/zaaReloaded2/Ribbon.xml index 07d2a1f..a16f66e 100755 --- a/zaaReloaded2/Ribbon.xml +++ b/zaaReloaded2/Ribbon.xml @@ -32,6 +32,9 @@ getVisible="Daniel_GetVisible"/> +