-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store picture markers against a range, rather than an address to bene…
…fit from range repository notifications
- Loading branch information
Showing
10 changed files
with
132 additions
and
116 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,37 @@ | ||
// Keep this file CodeMaid organised and cleaned | ||
using System; | ||
using System.Diagnostics; | ||
using System.Drawing; | ||
|
||
namespace ClosedXML.Excel.Drawings | ||
{ | ||
[DebuggerDisplay("{Address} {Offset}")] | ||
internal class XLMarker : IXLMarker | ||
internal class XLMarker | ||
{ | ||
internal XLMarker(IXLAddress address) | ||
: this(address, new Point(0, 0)) | ||
// Using a range to store the location so that it gets added to the range repository | ||
// and hence will be adjusted when there are insertions / deletions | ||
private readonly IXLRange rangeCell; | ||
|
||
internal XLMarker(IXLCell cell) | ||
: this(cell.AsRange(), new Point(0, 0)) | ||
{ } | ||
|
||
internal XLMarker(IXLCell cell, Point offset) | ||
: this(cell.AsRange(), offset) | ||
{ } | ||
|
||
internal XLMarker(IXLAddress address, Point offset) | ||
private XLMarker(IXLRange rangeCell, Point offset) | ||
{ | ||
this.Address = address; | ||
if (rangeCell.RowCount() != 1 || rangeCell.ColumnCount() != 1) | ||
throw new ArgumentException("Range should contain only one cell.", nameof(rangeCell)); | ||
|
||
this.rangeCell = rangeCell; | ||
this.Offset = offset; | ||
} | ||
|
||
public IXLAddress Address { get; set; } | ||
|
||
public IXLCell Cell { get => rangeCell.FirstCell(); } | ||
public Int32 ColumnNumber { get => rangeCell.RangeAddress.FirstAddress.ColumnNumber; } | ||
public Point Offset { get; set; } | ||
public Int32 RowNumber { get => rangeCell.RangeAddress.FirstAddress.RowNumber; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.