First commit

Send all results
This commit is contained in:
2020-09-04 12:49:15 +05:00
commit 330a2ccfda
2819 changed files with 226201 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
// ReSharper disable InconsistentNaming
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Indicates that this field can be accessed via SetValue and GetValue.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class DVAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the DVAttribute class.
/// </summary>
public DVAttribute()
{
RefOnly = false;
ItemType = null;
}
/// <summary>
/// Gets or sets the type of the reflected value. Must be specified by NEnum.
/// </summary>
public Type Type
{
get { return _type; }
set { _type = value; }
}
Type _type;
/// <summary>
/// Determines whether the field is RefOnly and should be excluded from recursive operations.
/// </summary>
public bool RefOnly;
// TODO: Check type in value descriptor
/// <summary>
/// Describes the type of the elements a collection contains.
/// </summary>
public Type ItemType;
}
}

View File

@@ -0,0 +1,91 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// A collection that manages ValueDescriptors.
/// </summary>
public class ValueDescriptorCollection : IEnumerable
{
/// <summary>
/// Gets the count of ValueDescriptors.
/// </summary>
public int Count
{
get { return _list.Count; }
}
/// <summary>
/// Adds the specified ValueDescriptor.
/// </summary>
public void Add(ValueDescriptor vd)
{
_dictionary.Add(vd.ValueName, vd);
_list.Add(vd);
}
/// <summary>
/// Gets the <see cref="MigraDoc.DocumentObjectModel.publics.ValueDescriptor"/> at the specified index.
/// </summary>
public ValueDescriptor this[int index]
{
get { return _list[index]; }
}
/// <summary>
/// Gets the <see cref="MigraDoc.DocumentObjectModel.publics.ValueDescriptor"/> with the specified name.
/// </summary>
public ValueDescriptor this[string name]
{
get { return _dictionary[name]; }
}
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
/// </returns>
public IEnumerator GetEnumerator()
{
return _list.GetEnumerator();
}
readonly List<ValueDescriptor> _list = new List<ValueDescriptor>();
readonly Dictionary<string, ValueDescriptor> _dictionary = new Dictionary<string, ValueDescriptor>(StringComparer.OrdinalIgnoreCase);
}
}

View File

@@ -0,0 +1,45 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Interface for simple nullable values like NInt, NString etc.
/// </summary>
public interface INullableValue
{
object GetValue();
void SetValue(object value);
void SetNull();
bool IsNull { get; }
}
}

View File

@@ -0,0 +1,282 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
using System.Reflection;
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Meta class for document objects.
/// </summary>
public sealed class Meta
{
/// <summary>
/// Initializes a new instance of the DomMeta class.
/// </summary>
public Meta(Type documentObjectType)
{
AddValueDescriptors(this, documentObjectType);
}
/// <summary>
/// Gets the meta object of the specified document object.
/// </summary>
/// <param name="documentObject">The document object the meta is returned for.</param>
public static Meta GetMeta(DocumentObject documentObject)
{
return documentObject.Meta;
}
/// <summary>
/// Gets the object specified by name from dom.
/// </summary>
public object GetValue(DocumentObject dom, string name, GV flags)
{
int dot = name.IndexOf('.');
if (dot == 0)
throw new ArgumentException(DomSR.InvalidValueName(name));
string trail = null;
if (dot > 0)
{
trail = name.Substring(dot + 1);
name = name.Substring(0, dot);
}
ValueDescriptor vd = _vds[name];
if (vd == null)
throw new ArgumentException(DomSR.InvalidValueName(name));
object value = vd.GetValue(dom, flags);
if (value == null && flags == GV.GetNull) //??? also for GV.ReadOnly?
return null;
//REVIEW DaSt: Create object in case of GV.ReadWrite?
if (trail != null)
{
if (value == null || trail == "")
throw new ArgumentException(DomSR.InvalidValueName(name));
DocumentObject doc = value as DocumentObject;
if (doc == null)
throw new ArgumentException(DomSR.InvalidValueName(name));
value = doc.GetValue(trail, flags);
}
return value;
}
/// <summary>
/// Sets the member of dom specified by name to val.
/// If a member with the specified name does not exist an ArgumentException will be thrown.
/// </summary>
public void SetValue(DocumentObject dom, string name, object val)
{
int dot = name.IndexOf('.');
if (dot == 0)
throw new ArgumentException(DomSR.InvalidValueName(name));
string trail = null;
if (dot > 0)
{
trail = name.Substring(dot + 1);
name = name.Substring(0, dot);
}
ValueDescriptor vd = _vds[name];
if (vd == null)
throw new ArgumentException(DomSR.InvalidValueName(name));
if (trail != null)
{
//REVIEW DaSt: dom.GetValue(name) and call SetValue recursively,
// or dom.GetValue(name.BisVorletzteElement) and then call SetValue?
DocumentObject doc = (DocumentObject)dom.GetValue(name);
doc.SetValue(trail, val);
}
else
vd.SetValue(dom, val);
}
/// <summary>
/// Determines whether this meta contains a value with the specified name.
/// </summary>
public bool HasValue(string name)
{
ValueDescriptor vd = _vds[name];
return vd != null;
}
/// <summary>
/// Sets the member of dom specified by name to null.
/// If a member with the specified name does not exist an ArgumentException will be thrown.
/// </summary>
public void SetNull(DocumentObject dom, string name)
{
ValueDescriptor vd = _vds[name];
if (vd == null)
throw new ArgumentException(DomSR.InvalidValueName(name));
vd.SetNull(dom);
}
/// <summary>
/// Determines whether the member of dom specified by name is null.
/// If a member with the specified name does not exist an ArgumentException will be thrown.
/// </summary>
public /* not virtual */ bool IsNull(DocumentObject dom, string name)
{
//bool isNull = false;
int dot = name.IndexOf('.');
if (dot == 0)
throw new ArgumentException(DomSR.InvalidValueName(name));
string trail = null;
if (dot > 0)
{
trail = name.Substring(dot + 1);
name = name.Substring(0, dot);
}
ValueDescriptor vd = _vds[name];
if (vd == null)
throw new ArgumentException(DomSR.InvalidValueName(name));
if (vd is NullableDescriptor || vd is ValueTypeDescriptor)
{
if (trail != null)
throw new ArgumentException(DomSR.InvalidValueName(name));
return vd.IsNull(dom);
}
DocumentObject docObj = (DocumentObject)vd.GetValue(dom, GV.ReadOnly);
if (docObj == null)
return true;
if (trail != null)
return docObj.IsNull(trail);
return docObj.IsNull();
// DomValueDescriptor vd = vds[name];
// if (vd == null)
// throw new ArgumentException(DomSR.InvalidValueName(name));
//
// return vd.IsNull(dom);
}
/// <summary>
/// Sets all members of the specified dom to null.
/// </summary>
public /*virtual*/ void SetNull(DocumentObject dom)
{
int count = _vds.Count;
for (int index = 0; index < count; index++)
{
if (!_vds[index].IsRefOnly)
_vds[index].SetNull(dom);
}
}
/// <summary>
/// Determines whether all members of the specified dom are null. If dom contains no members IsNull
/// returns true.
/// </summary>
public bool IsNull(DocumentObject dom)
{
int count = _vds.Count;
for (int index = 0; index < count; index++)
{
ValueDescriptor vd = _vds[index];
if (vd.IsRefOnly)
continue;
if (!vd.IsNull(dom))
return false;
}
return true;
}
/// <summary>
/// Gets the DomValueDescriptor of the member specified by name from the DocumentObject.
/// </summary>
public ValueDescriptor this[string name]
{
get { return _vds[name]; }
}
/// <summary>
/// Gets the DomValueDescriptorCollection of the DocumentObject.
/// </summary>
public ValueDescriptorCollection ValueDescriptors
{
get { return _vds; }
}
readonly ValueDescriptorCollection _vds = new ValueDescriptorCollection();
/// <summary>
/// Adds a value descriptor for each field and property found in type to meta.
/// </summary>
static void AddValueDescriptors(Meta meta, Type type)
{
#if !NETFX_CORE
FieldInfo[] fieldInfos = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
#else
var fieldInfos = type.GetTypeInfo().DeclaredFields;
#endif
foreach (FieldInfo fieldInfo in fieldInfos)
{
#if DEBUG_
string name = fieldInfo.Name;
if (name == "parent")
name.GetType();
#endif
DVAttribute[] dvs = (DVAttribute[])fieldInfo.GetCustomAttributes(typeof(DVAttribute), false);
if (dvs.Length == 1)
{
ValueDescriptor vd = ValueDescriptor.CreateValueDescriptor(fieldInfo, dvs[0]);
meta.ValueDescriptors.Add(vd);
}
}
#if !NETFX_CORE
PropertyInfo[] propInfos = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
#else
var propInfos = type.GetTypeInfo().DeclaredProperties;
#endif
foreach (PropertyInfo propInfo in propInfos)
{
#if DEBUG_
string name = propInfo.Name;
if (name == "Font")
name.GetType();
#endif
DVAttribute[] dvs = (DVAttribute[])propInfo.GetCustomAttributes(typeof(DVAttribute), false);
if (dvs.Length == 1)
{
ValueDescriptor vd = ValueDescriptor.CreateValueDescriptor(propInfo, dvs[0]);
meta.ValueDescriptors.Add(vd);
}
}
}
}
}

View File

@@ -0,0 +1,128 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Represents a nullable boolean value.
/// </summary>
public struct NBool : INullableValue
{
public NBool(bool value)
{
_value = value ? (sbyte)1 : (sbyte)0;
}
NBool(sbyte value)
{
_value = value;
}
/// <summary>
/// Gets or sets the value of the instance.
/// </summary>
public bool Value
{
get { return _value == 1; }
set { _value = value ? (sbyte)1 : (sbyte)0; }
}
/// <summary>
/// Gets the value of the instance.
/// </summary>
object INullableValue.GetValue()
{
return Value;
}
/// <summary>
/// Sets the value of the instance.
/// </summary>
void INullableValue.SetValue(object value)
{
_value = (bool)value ? (sbyte)1 : (sbyte)0;
}
/// <summary>
/// Resets this instance,
/// i.e. IsNull() will return true afterwards.
/// </summary>
public void SetNull()
{
_value = -1;
}
/// <summary>
/// Determines whether this instance is null (not set).
/// </summary>
public bool IsNull
{
get { return _value == -1; }
}
/// <summary>
/// Returns a value indicating whether this instance is equal to the specified object.
/// </summary>
public override bool Equals(object value)
{
if (value is NBool)
return this == (NBool)value;
return false;
}
public override int GetHashCode()
{
return _value.GetHashCode();
}
public static bool operator ==(NBool l, NBool r)
{
if (l.IsNull)
return r.IsNull;
if (r.IsNull)
return false;
return l.Value == r.Value;
}
public static bool operator !=(NBool l, NBool r)
{
return !(l == r);
}
public static readonly NBool NullValue = new NBool(-1);
/// <summary>
/// -1 (undefined), 0 (false), or 1 (true).
/// </summary>
sbyte _value;
}
}

View File

@@ -0,0 +1,120 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Represents a nullable double value.
/// </summary>
public struct NDouble : INullableValue
{
public NDouble(double value)
{
_value = value;
}
/// <summary>
/// Gets or sets the value of the instance.
/// </summary>
public double Value
{
get { return double.IsNaN(_value) ? 0 : _value; }
set { _value = value; }
}
/// <summary>
/// Gets the value of the instance.
/// </summary>
object INullableValue.GetValue()
{
return Value;
}
/// <summary>
/// Sets the value of the instance.
/// </summary>
void INullableValue.SetValue(object value)
{
_value = (double)value;
}
/// <summary>
/// Resets this instance,
/// i.e. IsNull() will return true afterwards.
/// </summary>
public void SetNull()
{
_value = double.NaN;
}
/// <summary>
/// Determines whether this instance is null (not set).
/// </summary>
public bool IsNull
{
get { return double.IsNaN(_value); }
}
/// <summary>
/// Returns a value indicating whether this instance is equal to the specified object.
/// </summary>
public override bool Equals(object value)
{
if (value is NDouble)
return this == (NDouble)value;
return false;
}
public override int GetHashCode()
{
return _value.GetHashCode();
}
public static bool operator ==(NDouble l, NDouble r)
{
if (l.IsNull)
return r.IsNull;
if (r.IsNull)
return false;
return l.Value == r.Value;
}
public static bool operator !=(NDouble l, NDouble r)
{
return !(l == r);
}
public static readonly NDouble NullValue = new NDouble(double.NaN);
double _value;
}
}

View File

@@ -0,0 +1,158 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Represents a nullable Enum value.
/// </summary>
public struct NEnum : INullableValue
{
public NEnum(int val, Type type)
{
_type = type;
_value = val;
}
NEnum(int value)
{
_type = null;
_value = value;
}
public Type Type
{
get { return _type; }
set { _type = value; }
}
Type _type;
public int Value
{
get { return _value != int.MinValue ? _value : 0; }
set
{
// TODO Remove German remarks!
//TODO: Klasse Character so <20>ndern, dass symbolName und char in unterschiedlichen Feldern gespeichert werden.
//Diese Spezialbehandlung entf<74>llt dann.
if (_type == typeof(SymbolName))
{
// if (Enum.IsDefined(this .type, (uint)value))
_value = value;
// else
// throw new ArgumentOutOfRangeException("value");
}
else
{
if (Enum.IsDefined(_type, value))
_value = value;
else
throw new /*InvalidEnum*/ArgumentException(DomSR.InvalidEnumValue(value), "value");
}
}
}
object INullableValue.GetValue()
{
return ToObject();
}
void INullableValue.SetValue(object value)
{
_value = (int)value;
}
public void SetNull()
{
_value = int.MinValue;
}
/// <summary>
/// Determines whether this instance is null (not set).
/// </summary>
public bool IsNull
{
get { return _value == int.MinValue; }
}
public object ToObject()
{
if (_value != int.MinValue)
return Enum.ToObject(_type, _value);
// BUG Have all enum 0 as valid value?
return Enum.ToObject(_type, 0);
}
//public static readonly NEnum NullValue = new NEnum(int.MinValue);
/// <summary>
/// Returns a value indicating whether this instance is equal to the specified object.
/// </summary>
public override bool Equals(object value)
{
if (value is NEnum)
return this == (NEnum)value;
return false;
}
public override int GetHashCode()
{
return _value.GetHashCode();
}
public static bool operator ==(NEnum l, NEnum r)
{
if (l.IsNull)
return r.IsNull;
if (r.IsNull)
return false;
if (l._type == r._type)
return l.Value == r.Value;
return false;
}
public static bool operator !=(NEnum l, NEnum r)
{
return !(l == r);
}
public static NEnum NullValue(Type fieldType)
{
return new NEnum(int.MinValue, fieldType);
}
int _value;
}
}

View File

@@ -0,0 +1,130 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Represents a nullable integer value.
/// </summary>
public struct NInt : INullableValue
{
public NInt(int val)
{
_value = val;
}
/// <summary>
/// Gets or sets the value of the instance.
/// </summary>
public int Value
{
get { return _value != int.MinValue ? _value : 0; }
set { _value = value; }
}
/// <summary>
/// Gets the value of the instance.
/// </summary>
object INullableValue.GetValue()
{
return Value;
}
/// <summary>
/// Sets the value of the instance.
/// </summary>
void INullableValue.SetValue(object value)
{
_value = (int)value;
}
/// <summary>
/// Resets this instance,
/// i.e. IsNull() will return true afterwards.
/// </summary>
public void SetNull()
{
_value = int.MinValue;
}
/// <summary>
/// Determines whether this instance is null (not set).
/// </summary>
public bool IsNull
{
get { return _value == int.MinValue; }
}
public static implicit operator NInt(int val)
{
return new NInt(val);
}
public static implicit operator int(NInt val)
{
return val.Value;
}
/// <summary>
/// Returns a value indicating whether this instance is equal to the specified object.
/// </summary>
public override bool Equals(object value)
{
if (value is NInt)
return this == (NInt)value;
return false;
}
public override int GetHashCode()
{
return _value.GetHashCode();
}
public static bool operator ==(NInt l, NInt r)
{
if (l.IsNull)
return r.IsNull;
if (r.IsNull)
return false;
return l.Value == r.Value;
}
public static bool operator !=(NInt l, NInt r)
{
return !(l == r);
}
public static readonly NInt NullValue = new NInt(int.MinValue);
int _value;
}
}

View File

@@ -0,0 +1,117 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Represents a nullable string value.
/// </summary>
public struct NString : INullableValue
{
/// <summary>
/// Gets or sets the value of the instance.
/// </summary>
public string Value
{
get { return _value ?? String.Empty; }
set { _value = value; }
}
/// <summary>
/// Returns the value of the instance.
/// </summary>
object INullableValue.GetValue()
{
return Value;
}
/// <summary>
/// Sets the value of the instance.
/// </summary>
void INullableValue.SetValue(object value)
{
_value = (String)value;
}
/// <summary>
/// Resets this instance,
/// i.e. IsNull() will return true afterwards.
/// </summary>
public void SetNull()
{
_value = null;
}
/// <summary>
/// Determines whether this instance is null (not set).
/// </summary>
public bool IsNull
{
get { return _value == null; }
}
/// <summary>
/// Returns a value indicating whether this instance is equal to the specified object.
/// </summary>
public override bool Equals(object value)
{
if (value is NString)
return this == (NString)value;
return false;
}
public override int GetHashCode()
{
return _value == null ? 0 : _value.GetHashCode();
}
public static bool operator ==(NString l, NString r)
{
if (l.IsNull)
return r.IsNull;
if (r.IsNull)
return false;
return l.Value == r.Value;
}
public static bool operator !=(NString l, NString r)
{
return !(l == r);
}
public static readonly NString NullValue = new NString();
string _value;
}
}

View File

@@ -0,0 +1,521 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
using System.Diagnostics;
using System.Reflection;
#pragma warning disable 1591
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Base class of all value descriptor classes.
/// </summary>
public abstract class ValueDescriptor
{
public ValueDescriptor(string valueName, Type valueType, Type memberType, MemberInfo memberInfo, VDFlags flags)
{
// Take new naming convention into account.
if (valueName.StartsWith("_"))
valueName = valueName.Substring(1);
ValueName = valueName;
ValueType = valueType;
MemberType = memberType;
MemberInfo = memberInfo;
_flags = flags;
}
public object CreateValue()
{
#if !NETFX_CORE
ConstructorInfo constructorInfo = ValueType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
#else
var constructorInfos = ValueType.GetTypeInfo().DeclaredConstructors;
ConstructorInfo constructorInfo = null;
foreach (var info in constructorInfos)
{
if (info.GetParameters().Length == 0)
constructorInfo = info;
}
#endif
Debug.Assert(constructorInfo != null);
return constructorInfo.Invoke(null);
}
public abstract object GetValue(DocumentObject dom, GV flags);
public abstract void SetValue(DocumentObject dom, object val);
public abstract void SetNull(DocumentObject dom);
public abstract bool IsNull(DocumentObject dom);
public static ValueDescriptor CreateValueDescriptor(MemberInfo memberInfo, DVAttribute attr)
{
VDFlags flags = VDFlags.None;
if (attr.RefOnly)
flags |= VDFlags.RefOnly;
string name = memberInfo.Name;
FieldInfo fieldInfo = memberInfo as FieldInfo;
Type type = fieldInfo != null ? fieldInfo.FieldType : ((PropertyInfo)memberInfo).PropertyType;
if (type == typeof(NBool))
return new NullableDescriptor(name, typeof(Boolean), type, memberInfo, flags);
if (type == typeof(NInt))
return new NullableDescriptor(name, typeof(Int32), type, memberInfo, flags);
if (type == typeof(NDouble))
return new NullableDescriptor(name, typeof(Double), type, memberInfo, flags);
if (type == typeof(NString))
return new NullableDescriptor(name, typeof(String), type, memberInfo, flags);
if (type == typeof(String))
return new ValueTypeDescriptor(name, typeof(String), type, memberInfo, flags);
if (type == typeof(NEnum))
{
Type valueType = attr.Type;
#if !NETFX_CORE
Debug.Assert(valueType.IsSubclassOf(typeof(Enum)), "NEnum must have 'Type' attribute with the underlying type");
#else
Debug.Assert(valueType.GetTypeInfo().IsSubclassOf(typeof(Enum)), "NEnum must have 'Type' attribute with the underlying type");
#endif
return new NullableDescriptor(name, valueType, type, memberInfo, flags);
}
#if !NETFX_CORE
if (type.IsSubclassOf(typeof(ValueType)))
#else
if (type.GetTypeInfo().IsSubclassOf(typeof(ValueType)))
#endif
return new ValueTypeDescriptor(name, type, type, memberInfo, flags);
#if !NETFX_CORE
if (typeof(DocumentObjectCollection).IsAssignableFrom(type))
#else
if (typeof(DocumentObjectCollection).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
#endif
return new DocumentObjectCollectionDescriptor(name, type, type, memberInfo, flags);
#if !NETFX_CORE
if (typeof(DocumentObject).IsAssignableFrom(type))
#else
if (typeof(DocumentObject).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
#endif
return new DocumentObjectDescriptor(name, type, type, memberInfo, flags);
Debug.Assert(false, type.FullName);
return null;
}
public bool IsRefOnly
{
get { return (_flags & VDFlags.RefOnly) == VDFlags.RefOnly; }
}
public FieldInfo FieldInfo
{
get { return MemberInfo as FieldInfo; }
}
public PropertyInfo PropertyInfo
{
get { return MemberInfo as PropertyInfo; }
}
/// <summary>
/// Name of the value.
/// </summary>
public readonly string ValueName;
/// <summary>
/// Type of the described value, e.g. typeof(Int32) for an NInt.
/// </summary>
public readonly Type ValueType;
/// <summary>
/// Type of the described field or property, e.g. typeof(NInt) for an NInt.
/// </summary>
public readonly Type MemberType;
/// <summary>
/// FieldInfo of the described field.
/// </summary>
public readonly MemberInfo MemberInfo;
/// <summary>
/// Flags of the described field, e.g. RefOnly.
/// </summary>
readonly VDFlags _flags;
}
/// <summary>
/// Value descriptor of all nullable types.
/// </summary>
public class NullableDescriptor : ValueDescriptor
{
public NullableDescriptor(string valueName, Type valueType, Type fieldType, MemberInfo memberInfo, VDFlags flags)
: base(valueName, valueType, fieldType, memberInfo, flags)
{ }
public override object GetValue(DocumentObject dom, GV flags)
{
if (!Enum.IsDefined(typeof(GV), flags))
throw new /*InvalidEnum*/ArgumentException(DomSR.InvalidEnumValue(flags), "flags");
#if !NETFX_CORE
object val = FieldInfo != null ? FieldInfo.GetValue(dom) : PropertyInfo.GetGetMethod(true).Invoke(dom, null);
#else
object val = FieldInfo != null ? FieldInfo.GetValue(dom) : PropertyInfo.GetValue(dom);
#endif
INullableValue ival = (INullableValue)val;
if (ival.IsNull && flags == GV.GetNull)
return null;
return ival.GetValue();
}
public override void SetValue(DocumentObject dom, object value)
{
object val;
INullableValue ival;
if (FieldInfo != null)
{
val = FieldInfo.GetValue(dom);
ival = (INullableValue)val;
ival.SetValue(value);
FieldInfo.SetValue(dom, ival);
}
else
{
#if !NETFX_CORE
val = PropertyInfo.GetGetMethod(true).Invoke(dom, null);
#else
val = PropertyInfo.GetValue(dom);
#endif
ival = (INullableValue)val;
ival.SetValue(value);
#if !NETFX_CORE
PropertyInfo.GetSetMethod(true).Invoke(dom, new object[] { ival });
#else
PropertyInfo.SetValue(dom, ival);
#endif
}
}
public override void SetNull(DocumentObject dom)
{
object val;
INullableValue ival;
if (FieldInfo != null)
{
val = FieldInfo.GetValue(dom);
ival = (INullableValue)val;
ival.SetNull();
FieldInfo.SetValue(dom, ival);
}
else
{
#if !NETFX_CORE
val = PropertyInfo.GetGetMethod(true).Invoke(dom, null);
#else
val = PropertyInfo.GetValue(dom);
#endif
ival = (INullableValue)val;
ival.SetNull();
#if !NETFX_CORE
PropertyInfo.GetSetMethod(true).Invoke(dom, new object[] { ival });
#else
PropertyInfo.SetValue(dom, ival);
#endif
}
}
/// <summary>
/// Determines whether the given DocumentObject is null (not set).
/// </summary>
public override bool IsNull(DocumentObject dom)
{
#if !NETFX_CORE
object val = FieldInfo != null ? FieldInfo.GetValue(dom) : PropertyInfo.GetGetMethod(true).Invoke(dom, null);
#else
object val = FieldInfo != null ? FieldInfo.GetValue(dom) : PropertyInfo.GetValue(dom);
#endif
return ((INullableValue)val).IsNull;
}
}
/// <summary>
/// Value descriptor of value types.
/// </summary>
public class ValueTypeDescriptor : ValueDescriptor
{
public ValueTypeDescriptor(string valueName, Type valueType, Type fieldType, MemberInfo memberInfo, VDFlags flags)
: base(valueName, valueType, fieldType, memberInfo, flags)
{ }
public override object GetValue(DocumentObject dom, GV flags)
{
if (!Enum.IsDefined(typeof(GV), flags))
throw new /*InvalidEnum*/ArgumentException(DomSR.InvalidEnumValue(flags), "flags");
#if !NETFX_CORE
object val = FieldInfo != null ? FieldInfo.GetValue(dom) : PropertyInfo.GetGetMethod(true).Invoke(dom, null);
#else
object val = FieldInfo != null ? FieldInfo.GetValue(dom) : PropertyInfo.GetValue(dom);
#endif
INullableValue ival = val as INullableValue;
if (ival != null && ival.IsNull && flags == GV.GetNull)
return null;
return val;
}
public override void SetValue(DocumentObject dom, object value)
{
if (FieldInfo != null)
FieldInfo.SetValue(dom, value);
else
#if !NETFX_CORE
PropertyInfo.GetSetMethod(true).Invoke(dom, new object[] { value });
#else
PropertyInfo.SetValue(dom, value);
#endif
}
public override void SetNull(DocumentObject dom)
{
object val;
INullableValue ival;
if (FieldInfo != null)
{
val = FieldInfo.GetValue(dom);
ival = (INullableValue)val;
ival.SetNull();
FieldInfo.SetValue(dom, ival);
}
else
{
#if !NETFX_CORE
val = PropertyInfo.GetGetMethod(true).Invoke(dom, null);
#else
val = PropertyInfo.GetValue(dom);
#endif
ival = (INullableValue)val;
ival.SetNull();
#if !NETFX_CORE
PropertyInfo.GetSetMethod(true).Invoke(dom, new object[] { ival });
#else
PropertyInfo.SetValue(dom, ival);
#endif
}
}
/// <summary>
/// Determines whether the given DocumentObject is null (not set).
/// </summary>
public override bool IsNull(DocumentObject dom)
{
#if !NETFX_CORE
object val = FieldInfo != null ? FieldInfo.GetValue(dom) : PropertyInfo.GetGetMethod(true).Invoke(dom, null);
#else
object val = FieldInfo != null ? FieldInfo.GetValue(dom) : PropertyInfo.GetValue(dom);
#endif
INullableValue ival = val as INullableValue;
if (ival != null)
return ival.IsNull;
return false;
}
}
/// <summary>
/// Value descriptor of DocumentObject.
/// </summary>
public class DocumentObjectDescriptor : ValueDescriptor
{
public DocumentObjectDescriptor(string valueName, Type valueType, Type fieldType, MemberInfo memberInfo, VDFlags flags)
: base(valueName, valueType, fieldType, memberInfo, flags)
{ }
public override object GetValue(DocumentObject dom, GV flags)
{
if (!Enum.IsDefined(typeof(GV), flags))
throw new /*InvalidEnum*/ArgumentException(DomSR.InvalidEnumValue(flags), "flags");
FieldInfo fieldInfo = FieldInfo;
DocumentObject val;
if (fieldInfo != null)
{
// Member is a field
val = FieldInfo.GetValue(dom) as DocumentObject;
if (val == null && flags == GV.ReadWrite)
{
val = (DocumentObject)CreateValue();
val._parent = dom;
FieldInfo.SetValue(dom, val);
return val;
}
}
else
{
// Member is a property
#if !NETFX_CORE
val = PropertyInfo.GetGetMethod(true).Invoke(dom, null) as DocumentObject;
#else
val = PropertyInfo.GetValue(dom) as DocumentObject;
#endif
}
if (val != null && (val.IsNull() && flags == GV.GetNull))
return null;
return val;
}
public override void SetValue(DocumentObject dom, object val)
{
FieldInfo fieldInfo = FieldInfo;
// Member is a field
if (fieldInfo != null)
{
fieldInfo.SetValue(dom, val);
return;
}
throw new InvalidOperationException("This value cannot be set.");
}
public override void SetNull(DocumentObject dom)
{
FieldInfo fieldInfo = FieldInfo;
DocumentObject val;
// Member is a field.
if (fieldInfo != null)
{
val = FieldInfo.GetValue(dom) as DocumentObject;
if (val != null)
val.SetNull();
}
// Member is a property.
if (PropertyInfo != null)
{
PropertyInfo propInfo = PropertyInfo;
#if !NETFX_CORE
val = propInfo.GetGetMethod(true).Invoke(dom, null) as DocumentObject;
#else
val = propInfo.GetValue(dom) as DocumentObject;
#endif
if (val != null)
val.SetNull();
}
}
/// <summary>
/// Determines whether the given DocumentObject is null (not set).
/// </summary>
public override bool IsNull(DocumentObject dom)
{
FieldInfo fieldInfo = FieldInfo;
DocumentObject val;
// Member is a field
if (fieldInfo != null)
{
val = FieldInfo.GetValue(dom) as DocumentObject;
if (val == null)
return true;
return val.IsNull();
}
// Member is a property
PropertyInfo propInfo = PropertyInfo;
#if !NETFX_CORE
val = propInfo.GetGetMethod(true).Invoke(dom, null) as DocumentObject;
#else
val = propInfo.GetValue(dom) as DocumentObject;
#endif
if (val != null)
val.IsNull();
return true;
}
}
/// <summary>
/// Value descriptor of DocumentObjectCollection.
/// </summary>
public class DocumentObjectCollectionDescriptor : ValueDescriptor
{
public DocumentObjectCollectionDescriptor(string valueName, Type valueType, Type fieldType, MemberInfo memberInfo, VDFlags flags)
: base(valueName, valueType, fieldType, memberInfo, flags)
{ }
public override object GetValue(DocumentObject dom, GV flags)
{
if (!Enum.IsDefined(typeof(GV), flags))
throw new /*InvalidEnum*/ArgumentException(DomSR.InvalidEnumValue(flags), "flags");
Debug.Assert(MemberInfo is FieldInfo, "Properties of DocumentObjectCollection not allowed.");
DocumentObjectCollection val = FieldInfo.GetValue(dom) as DocumentObjectCollection;
if (val == null && flags == GV.ReadWrite)
{
val = (DocumentObjectCollection)CreateValue();
val._parent = dom;
FieldInfo.SetValue(dom, val);
return val;
}
if (val != null && val.IsNull() && flags == GV.GetNull)
return null;
return val;
}
public override void SetValue(DocumentObject dom, object val)
{
FieldInfo.SetValue(dom, val);
}
public override void SetNull(DocumentObject dom)
{
DocumentObjectCollection val = FieldInfo.GetValue(dom) as DocumentObjectCollection;
if (val != null)
val.SetNull();
}
/// <summary>
/// Determines whether the given DocumentObject is null (not set).
/// </summary>
public override bool IsNull(DocumentObject dom)
{
DocumentObjectCollection val = FieldInfo.GetValue(dom) as DocumentObjectCollection;
if (val == null)
return true;
return val.IsNull();
}
}
}

View File

@@ -0,0 +1,57 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
// ReSharper disable InconsistentNaming
namespace MigraDoc.DocumentObjectModel.publics
{
/// <summary>
/// Indicates how to retrieve a value from a DocumentObject.
/// </summary>
public enum GV
{
/// <summary>
/// Gets the value for reading and writing. If the value does not exist, it is created.
/// </summary>
ReadWrite = 0,
/// <summary>
/// Gets the value for reading. If the value does not exist, it is not created.
/// </summary>
ReadOnly = 1,
/// <summary>
/// Returns null if value is Null or does not exist.
/// </summary>
GetNull = 2,
}
}

View File

@@ -0,0 +1,45 @@
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange
// Klaus Potzesny
// David Stephensen
//
// Copyright (c) 2001-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
// ReSharper disable InconsistentNaming
namespace MigraDoc.DocumentObjectModel.publics
{
[Flags]
public enum VDFlags
{
None = 0,
RefOnly = 0x0001
}
}