@@ -39,7 +39,7 @@ namespace PdfSharpCore.Pdf
39
39
/// <summary>
40
40
/// Represents a collection of outlines.
41
41
/// </summary>
42
- public class PdfOutlineCollection : PdfObject , ICollection < PdfOutline > , IList < PdfOutline >
42
+ public class PdfOutlineCollection : PdfObject , IList < PdfOutline >
43
43
{
44
44
/// <summary>
45
45
/// Can only be created as part of PdfOutline.
@@ -66,26 +66,20 @@ public bool Remove(PdfOutline item)
66
66
/// <summary>
67
67
/// Gets the number of entries in this collection.
68
68
/// </summary>
69
- public int Count
70
- {
71
- get { return _outlines . Count ; }
72
- }
69
+ public int Count => _outlines . Count ;
73
70
74
71
/// <summary>
75
72
/// Returns false.
76
73
/// </summary>
77
- public bool IsReadOnly
78
- {
79
- get { return false ; }
80
- }
74
+ public bool IsReadOnly => false ;
81
75
82
76
/// <summary>
83
77
/// Adds the specified outline.
84
78
/// </summary>
85
79
public void Add ( PdfOutline outline )
86
80
{
87
81
if ( outline == null )
88
- throw new ArgumentNullException ( " outline" ) ;
82
+ throw new ArgumentNullException ( nameof ( outline ) ) ;
89
83
90
84
// DestinationPage is optional. PDFsharp does not yet support outlines with action ("/A") instead of destination page ("/DEST")
91
85
if ( outline . DestinationPage != null && ! ReferenceEquals ( Owner , outline . DestinationPage . Owner ) )
@@ -209,9 +203,9 @@ public int IndexOf(PdfOutline item)
209
203
public void Insert ( int index , PdfOutline outline )
210
204
{
211
205
if ( outline == null )
212
- throw new ArgumentNullException ( " outline" ) ;
206
+ throw new ArgumentNullException ( nameof ( outline ) ) ;
213
207
if ( index < 0 || index >= _outlines . Count )
214
- throw new ArgumentOutOfRangeException ( " index" , index , PSSR . OutlineIndexOutOfRange ) ;
208
+ throw new ArgumentOutOfRangeException ( nameof ( index ) , index , PSSR . OutlineIndexOutOfRange ) ;
215
209
216
210
AddToOutlinesTree ( outline ) ;
217
211
_outlines . Insert ( index , outline ) ;
@@ -235,15 +229,15 @@ public PdfOutline this[int index]
235
229
get
236
230
{
237
231
if ( index < 0 || index >= _outlines . Count )
238
- throw new ArgumentOutOfRangeException ( " index" , index , PSSR . OutlineIndexOutOfRange ) ;
232
+ throw new ArgumentOutOfRangeException ( nameof ( index ) , index , PSSR . OutlineIndexOutOfRange ) ;
239
233
return _outlines [ index ] ;
240
234
}
241
235
set
242
236
{
243
237
if ( index < 0 || index >= _outlines . Count )
244
- throw new ArgumentOutOfRangeException ( " index" , index , PSSR . OutlineIndexOutOfRange ) ;
238
+ throw new ArgumentOutOfRangeException ( nameof ( index ) , index , PSSR . OutlineIndexOutOfRange ) ;
245
239
if ( value == null )
246
- throw new ArgumentOutOfRangeException ( " value" , null , PSSR . SetValueMustNotBeNull ) ;
240
+ throw new ArgumentOutOfRangeException ( nameof ( value ) , null , PSSR . SetValueMustNotBeNull ) ;
247
241
248
242
AddToOutlinesTree ( value ) ;
249
243
_outlines [ index ] = value ;
@@ -274,7 +268,7 @@ internal int CountOpen()
274
268
void AddToOutlinesTree ( PdfOutline outline )
275
269
{
276
270
if ( outline == null )
277
- throw new ArgumentNullException ( " outline" ) ;
271
+ throw new ArgumentNullException ( nameof ( outline ) ) ;
278
272
279
273
// DestinationPage is optional. PDFsharp does not yet support outlines with action ("/A") instead of destination page ("/DEST")
280
274
if ( outline . DestinationPage != null && ! ReferenceEquals ( Owner , outline . DestinationPage . Owner ) )
@@ -287,10 +281,10 @@ void AddToOutlinesTree(PdfOutline outline)
287
281
//_outlines.Add(outline);
288
282
if ( ! Owner . _irefTable . Contains ( outline . ObjectID ) )
289
283
Owner . _irefTable . Add ( outline ) ;
290
- else
291
- {
292
- outline . GetType ( ) ;
293
- }
284
+ // else
285
+ // {
286
+ // outline.GetType();
287
+ // }
294
288
295
289
//if (outline.Opened)
296
290
//{
@@ -306,7 +300,7 @@ void AddToOutlinesTree(PdfOutline outline)
306
300
void RemoveFromOutlinesTree ( PdfOutline outline )
307
301
{
308
302
if ( outline == null )
309
- throw new ArgumentNullException ( " outline" ) ;
303
+ throw new ArgumentNullException ( nameof ( outline ) ) ;
310
304
311
305
// TODO check the parent problems...
312
306
//outline.Document = Owner;
@@ -316,7 +310,7 @@ void RemoveFromOutlinesTree(PdfOutline outline)
316
310
}
317
311
318
312
/// <summary>
319
- /// The parent outine of this collection.
313
+ /// The parent outline of this collection.
320
314
/// </summary>
321
315
readonly PdfOutline _parent ;
322
316
0 commit comments