-
-
Notifications
You must be signed in to change notification settings - Fork 276
/
Copy pathExcelAttributes.cs
152 lines (132 loc) · 4.53 KB
/
ExcelAttributes.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// Copyright (c) Govert van Drimmelen. All rights reserved.
// Excel-DNA is licensed under the zlib license. See LICENSE.txt for details.
using System;
using JetBrains.Annotations;
namespace ExcelDna.Integration
{
/// <summary>
/// For user-defined functions.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
[MeansImplicitUse]
public class ExcelFunctionAttribute : Attribute
{
/// <summary>
/// By default the name of the add-in.
/// </summary>
public string Category = null;
public string Name = null;
public string Description = null;
public string HelpTopic = null;
public bool IsVolatile = false;
public bool IsHidden = false;
public bool IsExceptionSafe = false;
public bool IsMacroType = false;
public bool IsThreadSafe = false;
public bool IsClusterSafe = false;
public bool ExplicitRegistration = false;
public bool SuppressOverwriteError = false;
public ExcelFunctionAttribute()
{
}
public ExcelFunctionAttribute(string description)
{
Description = description;
}
}
/// <summary>
/// For the arguments of user-defined functions.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
[MeansImplicitUse]
public class ExcelArgumentAttribute : Attribute
{
/// <summary>
/// Arguments of type object may receive ExcelReference.
/// </summary>
public bool AllowReference = false;
public string Name = null;
public string Description = null;
public ExcelArgumentAttribute()
{
}
public ExcelArgumentAttribute(string description)
{
Description = description;
}
}
/// <summary>
/// For the arguments of object handles.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
[MeansImplicitUse]
public class ExcelHandleAttribute : Attribute
{
}
/// <summary>
/// To indicate that a type will be marshalled as object handles.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[MeansImplicitUse]
public class ExcelHandleExternalAttribute : Attribute
{
public ExcelHandleExternalAttribute(Type type)
{
Type = type;
}
public Type Type { get; }
}
/// <summary>
/// For macro commands.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
[MeansImplicitUse]
public class ExcelCommandAttribute : Attribute
{
public string Name = null;
public string Description = null;
public string HelpTopic = null;
public string ShortCut = null;
public string MenuName = null;
public string MenuText = null;
public bool IsExceptionSafe = false;
public bool ExplicitRegistration = false;
public bool SuppressOverwriteError = false;
[Obsolete("ExcelFunctions can be declared hidden, not ExcelCommands.")]
public bool IsHidden = false;
public ExcelCommandAttribute()
{
}
public ExcelCommandAttribute(string description)
{
Description = description;
}
}
// An extension of the ExcelFunction attribute to identify functions that should be registered as async
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
[MeansImplicitUse]
public class ExcelAsyncFunctionAttribute : ExcelFunctionAttribute
{
}
/// <summary>
/// For user-defined parameter conversions.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
[MeansImplicitUse]
public class ExcelParameterConversionAttribute : Attribute
{
}
/// <summary>
/// For user-defined function execution handlers.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
[MeansImplicitUse]
public class ExcelFunctionExecutionHandlerSelectorAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
[MeansImplicitUse]
public class ExcelFunctionProcessorAttribute : Attribute
{
}
}