@syncfusion/ej2-pdf-export 19.4.52 → 20.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/ej2-pdf-export.umd.min.js +1 -1
  2. package/dist/global/ej2-pdf-export.min.js +1 -1
  3. package/dist/global/index.d.ts +1 -1
  4. package/dist/ts/implementation/actions/action.ts +76 -0
  5. package/dist/ts/implementation/actions/uri-action.ts +52 -0
  6. package/dist/ts/implementation/annotations/action-link-annotation.ts +43 -0
  7. package/dist/ts/implementation/annotations/annotation-collection.ts +159 -0
  8. package/dist/ts/implementation/annotations/annotation.ts +241 -0
  9. package/dist/ts/implementation/annotations/document-link-annotation.ts +118 -0
  10. package/dist/ts/implementation/annotations/link-annotation.ts +32 -0
  11. package/dist/ts/implementation/annotations/pdf-text-web-link.ts +265 -0
  12. package/dist/ts/implementation/annotations/uri-annotation.ts +86 -0
  13. package/dist/ts/implementation/collections/dictionary.ts +150 -0
  14. package/dist/ts/implementation/collections/object-object-pair/dictionary.ts +125 -0
  15. package/dist/ts/implementation/collections/utils.ts +38 -0
  16. package/dist/ts/implementation/document/automatic-fields/automatic-field-info-collection.ts +39 -0
  17. package/dist/ts/implementation/document/automatic-fields/automatic-field-info.ts +108 -0
  18. package/dist/ts/implementation/document/automatic-fields/automatic-field.ts +127 -0
  19. package/dist/ts/implementation/document/automatic-fields/composite-field.ts +76 -0
  20. package/dist/ts/implementation/document/automatic-fields/multiple-value-field.ts +37 -0
  21. package/dist/ts/implementation/document/automatic-fields/page-count-field.ts +75 -0
  22. package/dist/ts/implementation/document/automatic-fields/pdf-numbers-convertor.ts +157 -0
  23. package/dist/ts/implementation/document/automatic-fields/pdf-page-number-field.ts +82 -0
  24. package/dist/ts/implementation/document/automatic-fields/pdf-template-value-pair.ts +60 -0
  25. package/dist/ts/implementation/document/automatic-fields/single-value-field.ts +48 -0
  26. package/dist/ts/implementation/document/pdf-catalog.ts +52 -0
  27. package/dist/ts/implementation/document/pdf-document-base.ts +166 -0
  28. package/dist/ts/implementation/document/pdf-document-template.ts +310 -0
  29. package/dist/ts/implementation/document/pdf-document.ts +342 -0
  30. package/dist/ts/implementation/drawing/pdf-drawing.ts +218 -0
  31. package/dist/ts/implementation/general/enum.ts +21 -0
  32. package/dist/ts/implementation/general/functions/pdf-function.ts +66 -0
  33. package/dist/ts/implementation/general/functions/pdf-sampled-function.ts +62 -0
  34. package/dist/ts/implementation/general/pdf-cache-collection.ts +97 -0
  35. package/dist/ts/implementation/general/pdf-collection.ts +41 -0
  36. package/dist/ts/implementation/general/pdf-destination.ts +170 -0
  37. package/dist/ts/implementation/graphics/brushes/enum.ts +237 -0
  38. package/dist/ts/implementation/graphics/brushes/pdf-blend.ts +294 -0
  39. package/dist/ts/implementation/graphics/brushes/pdf-brush.ts +68 -0
  40. package/dist/ts/implementation/graphics/brushes/pdf-brushes.ts +2438 -0
  41. package/dist/ts/implementation/graphics/brushes/pdf-color-blend.ts +295 -0
  42. package/dist/ts/implementation/graphics/brushes/pdf-gradient-brush.ts +311 -0
  43. package/dist/ts/implementation/graphics/brushes/pdf-linear-gradient-brush.ts +406 -0
  44. package/dist/ts/implementation/graphics/brushes/pdf-radial-gradient-brush.ts +290 -0
  45. package/dist/ts/implementation/graphics/brushes/pdf-solid-brush.ts +107 -0
  46. package/dist/ts/implementation/graphics/brushes/pdf-tiling-brush.ts +304 -0
  47. package/dist/ts/implementation/graphics/constants.ts +31 -0
  48. package/dist/ts/implementation/graphics/enum.ts +413 -0
  49. package/dist/ts/implementation/graphics/figures/arc.ts +133 -0
  50. package/dist/ts/implementation/graphics/figures/base/draw-element.ts +59 -0
  51. package/dist/ts/implementation/graphics/figures/base/element-layouter.ts +260 -0
  52. package/dist/ts/implementation/graphics/figures/base/fill-element.ts +72 -0
  53. package/dist/ts/implementation/graphics/figures/base/graphics-element.ts +34 -0
  54. package/dist/ts/implementation/graphics/figures/base/pdf-shape-element.ts +69 -0
  55. package/dist/ts/implementation/graphics/figures/base/shape-layouter.ts +276 -0
  56. package/dist/ts/implementation/graphics/figures/base/text-layouter.ts +205 -0
  57. package/dist/ts/implementation/graphics/figures/ellipse-part.ts +76 -0
  58. package/dist/ts/implementation/graphics/figures/enum.ts +80 -0
  59. package/dist/ts/implementation/graphics/figures/layout-element.ts +132 -0
  60. package/dist/ts/implementation/graphics/figures/path.ts +646 -0
  61. package/dist/ts/implementation/graphics/figures/pdf-template.ts +205 -0
  62. package/dist/ts/implementation/graphics/figures/rectangle-area.ts +108 -0
  63. package/dist/ts/implementation/graphics/figures/text-element.ts +445 -0
  64. package/dist/ts/implementation/graphics/fonts/enum.ts +385 -0
  65. package/dist/ts/implementation/graphics/fonts/pdf-font-metrics.ts +248 -0
  66. package/dist/ts/implementation/graphics/fonts/pdf-font.ts +316 -0
  67. package/dist/ts/implementation/graphics/fonts/pdf-standard-font-metrics-factory.ts +606 -0
  68. package/dist/ts/implementation/graphics/fonts/pdf-standard-font.ts +243 -0
  69. package/dist/ts/implementation/graphics/fonts/pdf-string-format.ts +474 -0
  70. package/dist/ts/implementation/graphics/fonts/pdf-true-type-font.ts +165 -0
  71. package/dist/ts/implementation/graphics/fonts/rtl/rtl-bidirectional.ts +958 -0
  72. package/dist/ts/implementation/graphics/fonts/rtl/rtl-text-shape.ts +374 -0
  73. package/dist/ts/implementation/graphics/fonts/rtl-renderer.ts +255 -0
  74. package/dist/ts/implementation/graphics/fonts/string-layouter.ts +617 -0
  75. package/dist/ts/implementation/graphics/fonts/string-tokenizer.ts +275 -0
  76. package/dist/ts/implementation/graphics/fonts/ttf-OS2-Table.ts +206 -0
  77. package/dist/ts/implementation/graphics/fonts/ttf-apple-cmap-sub-table.ts +18 -0
  78. package/dist/ts/implementation/graphics/fonts/ttf-cmap-sub-table.ts +18 -0
  79. package/dist/ts/implementation/graphics/fonts/ttf-cmap-table.ts +14 -0
  80. package/dist/ts/implementation/graphics/fonts/ttf-glyph-header.ts +26 -0
  81. package/dist/ts/implementation/graphics/fonts/ttf-glyph-info.ts +35 -0
  82. package/dist/ts/implementation/graphics/fonts/ttf-head-table.ts +94 -0
  83. package/dist/ts/implementation/graphics/fonts/ttf-horizontal-header-table.ts +56 -0
  84. package/dist/ts/implementation/graphics/fonts/ttf-loca-table.ts +10 -0
  85. package/dist/ts/implementation/graphics/fonts/ttf-long-hor-metric.ts +14 -0
  86. package/dist/ts/implementation/graphics/fonts/ttf-metrics.ts +106 -0
  87. package/dist/ts/implementation/graphics/fonts/ttf-microsoft-cmap-sub-table.ts +58 -0
  88. package/dist/ts/implementation/graphics/fonts/ttf-name-record.ts +33 -0
  89. package/dist/ts/implementation/graphics/fonts/ttf-name-table.ts +22 -0
  90. package/dist/ts/implementation/graphics/fonts/ttf-post-table.ts +42 -0
  91. package/dist/ts/implementation/graphics/fonts/ttf-reader.ts +1254 -0
  92. package/dist/ts/implementation/graphics/fonts/ttf-table-info.ts +26 -0
  93. package/dist/ts/implementation/graphics/fonts/ttf-trimmed-cmap-sub-table.ts +26 -0
  94. package/dist/ts/implementation/graphics/fonts/unicode-true-type-font.ts +577 -0
  95. package/dist/ts/implementation/graphics/images/byte-array.ts +137 -0
  96. package/dist/ts/implementation/graphics/images/image-decoder.ts +437 -0
  97. package/dist/ts/implementation/graphics/images/pdf-bitmap.ts +110 -0
  98. package/dist/ts/implementation/graphics/images/pdf-image.ts +132 -0
  99. package/dist/ts/implementation/graphics/pdf-color.ts +478 -0
  100. package/dist/ts/implementation/graphics/pdf-graphics.ts +2424 -0
  101. package/dist/ts/implementation/graphics/pdf-margins.ts +124 -0
  102. package/dist/ts/implementation/graphics/pdf-pen.ts +370 -0
  103. package/dist/ts/implementation/graphics/pdf-resources.ts +300 -0
  104. package/dist/ts/implementation/graphics/pdf-transformation-matrix.ts +246 -0
  105. package/dist/ts/implementation/graphics/pdf-transparency.ts +93 -0
  106. package/dist/ts/implementation/graphics/unit-convertor.ts +96 -0
  107. package/dist/ts/implementation/input-output/big-endian-writer.ts +121 -0
  108. package/dist/ts/implementation/input-output/cross-table.ts +21 -0
  109. package/dist/ts/implementation/input-output/enum.ts +16 -0
  110. package/dist/ts/implementation/input-output/pdf-cross-table.ts +524 -0
  111. package/dist/ts/implementation/input-output/pdf-dictionary-properties.ts +515 -0
  112. package/dist/ts/implementation/input-output/pdf-main-object-collection.ts +194 -0
  113. package/dist/ts/implementation/input-output/pdf-operators.ts +363 -0
  114. package/dist/ts/implementation/input-output/pdf-stream-writer.ts +681 -0
  115. package/dist/ts/implementation/input-output/pdf-writer.ts +88 -0
  116. package/dist/ts/implementation/pages/enum.ts +201 -0
  117. package/dist/ts/implementation/pages/page-added-event-arguments.ts +39 -0
  118. package/dist/ts/implementation/pages/pdf-document-page-collection.ts +180 -0
  119. package/dist/ts/implementation/pages/pdf-page-base.ts +181 -0
  120. package/dist/ts/implementation/pages/pdf-page-layer-collection.ts +348 -0
  121. package/dist/ts/implementation/pages/pdf-page-layer.ts +271 -0
  122. package/dist/ts/implementation/pages/pdf-page-settings.ts +192 -0
  123. package/dist/ts/implementation/pages/pdf-page-size.ts +162 -0
  124. package/dist/ts/implementation/pages/pdf-page-template-element.ts +659 -0
  125. package/dist/ts/implementation/pages/pdf-page.ts +235 -0
  126. package/dist/ts/implementation/pages/pdf-section-collection.ts +187 -0
  127. package/dist/ts/implementation/pages/pdf-section-page-collection.ts +61 -0
  128. package/dist/ts/implementation/pages/pdf-section-templates.ts +96 -0
  129. package/dist/ts/implementation/pages/pdf-section.ts +644 -0
  130. package/dist/ts/implementation/primitives/pdf-array.ts +386 -0
  131. package/dist/ts/implementation/primitives/pdf-boolean.ts +119 -0
  132. package/dist/ts/implementation/primitives/pdf-dictionary.ts +513 -0
  133. package/dist/ts/implementation/primitives/pdf-name.ts +218 -0
  134. package/dist/ts/implementation/primitives/pdf-number.ts +165 -0
  135. package/dist/ts/implementation/primitives/pdf-reference.ts +430 -0
  136. package/dist/ts/implementation/primitives/pdf-stream.ts +336 -0
  137. package/dist/ts/implementation/primitives/pdf-string.ts +397 -0
  138. package/dist/ts/implementation/structured-elements/grid/layout/grid-layouter.ts +2027 -0
  139. package/dist/ts/implementation/structured-elements/grid/pdf-grid-cell.ts +1189 -0
  140. package/dist/ts/implementation/structured-elements/grid/pdf-grid-column.ts +206 -0
  141. package/dist/ts/implementation/structured-elements/grid/pdf-grid-row.ts +470 -0
  142. package/dist/ts/implementation/structured-elements/grid/pdf-grid.ts +853 -0
  143. package/dist/ts/implementation/structured-elements/grid/styles/pdf-borders.ts +240 -0
  144. package/dist/ts/implementation/structured-elements/grid/styles/style.ts +424 -0
  145. package/dist/ts/implementation/structured-elements/tables/light-tables/enum.ts +16 -0
  146. package/dist/ts/interfaces/i-pdf-cache.ts +23 -0
  147. package/dist/ts/interfaces/i-pdf-changable.ts +17 -0
  148. package/dist/ts/interfaces/i-pdf-clonable.ts +12 -0
  149. package/dist/ts/interfaces/i-pdf-primitives.ts +45 -0
  150. package/dist/ts/interfaces/i-pdf-true-type-font.ts +48 -0
  151. package/dist/ts/interfaces/i-pdf-wrapper.ts +13 -0
  152. package/dist/ts/interfaces/i-pdf-writer.ts +29 -0
  153. package/package.json +6 -6
  154. package/CHANGELOG.md +0 -81
@@ -0,0 +1,2027 @@
1
+ /**
2
+ * PdfGridLayouter.ts class for EJ2-PDF
3
+ */
4
+ import { PdfFont } from './../../../graphics/fonts/pdf-font';
5
+ import { PdfGrid } from '../pdf-grid';
6
+ import { PdfStringFormat } from './../../../graphics/fonts/pdf-string-format';
7
+ import { SizeF, RectangleF, PointF } from './../../../drawing/pdf-drawing';
8
+ import { PdfBorders } from '../styles/pdf-borders';
9
+ import { PdfLayoutType, PdfLayoutBreakType } from './../../../graphics/figures/enum';
10
+ import { PdfLayoutResult, PdfLayoutParams, PdfLayoutFormat, ElementLayouter } from './../../../graphics/figures/base/element-layouter';
11
+ import { PdfLayoutElement } from './../../../graphics/figures/layout-element';
12
+ import { PdfGraphics } from './../../../graphics/pdf-graphics';
13
+ import { PdfPage } from './../../../pages/pdf-page';
14
+ import { PdfPageBase } from './../../../pages/pdf-page-base';
15
+ import { PdfGridColumnCollection } from '../pdf-grid-column';
16
+ import { PdfGridCell } from '../pdf-grid-cell';
17
+ import { PdfGridRow } from '../pdf-grid-row';
18
+ import { PdfGridStyle, PdfGridCellStyle } from '../styles/style';
19
+ import { PdfGridRowCollection, PdfGridHeaderCollection } from '../pdf-grid-row';
20
+ import { PdfHorizontalOverflowType } from '../styles/style';
21
+ import { TemporaryDictionary } from './../../../collections/object-object-pair/dictionary';
22
+ import { PdfStringLayoutResult, PdfStringLayouter } from './../../../graphics/fonts/string-layouter';
23
+ import { PdfDocument } from './../../../document/pdf-document';
24
+ import { PdfSection } from './../../../pages/pdf-section';
25
+ /**
26
+ * Class `lay outing the text`.
27
+ *
28
+ */
29
+ export class PdfGridLayouter extends ElementLayouter {
30
+ // Fields
31
+ /**
32
+ * `Text` data.
33
+ * @private
34
+ */
35
+ private text : string;
36
+ // private layoutElement : PdfLayoutElement;
37
+ /**
38
+ * Pdf `font`.
39
+ * @private
40
+ */
41
+ private font : PdfFont;
42
+ /**
43
+ * String `format`.
44
+ * @private
45
+ */
46
+ private format : PdfStringFormat;
47
+ /**
48
+ * `Size` of the text.
49
+ * @private
50
+ */
51
+ private gridColumns : PdfGridColumnCollection;
52
+ /**
53
+ * @hidden
54
+ * @private
55
+ */
56
+ private gridRows : PdfGridRowCollection;
57
+ /**
58
+ * @hidden
59
+ * @private
60
+ */
61
+ private gridHeaders : PdfGridHeaderCollection;
62
+ /**
63
+ * @hidden
64
+ * @private
65
+ */
66
+ private gridInitialWidth : number = 0;
67
+ /**
68
+ * @hidden
69
+ * @private
70
+ */
71
+ public isComplete : boolean;
72
+ /**
73
+ * @hidden
74
+ * @private
75
+ */
76
+ private gridSize : SizeF = new SizeF(0, 0);
77
+ private parentCell : PdfGridCell;
78
+ private parentCellIndex : number = 0;
79
+ public tempWidth : number = 0;
80
+ private childheight : number = 0;
81
+ /**
82
+ * The event raised on `starting cell drawing`.
83
+ * @event
84
+ * @private
85
+ */
86
+ public beginCellDraw : Function;
87
+ /**
88
+ * The event raised on `ending cell drawing`.
89
+ * @event
90
+ * @private
91
+ */
92
+ public endCellDraw : Function;
93
+ /**
94
+ * The event raised on `begin cell lay outing`.
95
+ * @event
96
+ * @private
97
+ */
98
+ public beginPageLayout : Function;
99
+ /**
100
+ * The event raised on `end cell lay outing`.
101
+ * @event
102
+ * @private
103
+ */
104
+ public endPageLayout : Function;
105
+
106
+ /**
107
+ * @hidden
108
+ * @private
109
+ */
110
+ /**
111
+ * @hidden
112
+ * @private
113
+ */
114
+ private gridLocation : RectangleF;
115
+ /**
116
+ * @hidden
117
+ * @private
118
+ */
119
+ private gridStyle : PdfGridStyle;
120
+ /**
121
+ * @hidden
122
+ * @private
123
+ */
124
+ private pageWidth : boolean;
125
+ /**
126
+ * Check weather it is `child grid or not`.
127
+ * @private
128
+ */
129
+ private isChildGrid : boolean = false;
130
+ /**
131
+ * @hidden
132
+ * @private
133
+ */
134
+ public rowLayoutBoundsWidth : number;
135
+ /**
136
+ * @hidden
137
+ * @private
138
+ */
139
+ public hasRowSpanSpan : boolean = false;
140
+ /**
141
+ * @hidden
142
+ * @private
143
+ */
144
+ public isRearranged : boolean = false;
145
+ /**
146
+ * @hidden
147
+ * @private
148
+ */
149
+ private bRepeatHeader : boolean;
150
+ /**
151
+ * @hidden
152
+ * @private
153
+ */
154
+ private pageBounds : RectangleF = new RectangleF();
155
+ //GridLayouter-Fields
156
+ /**
157
+ * @hidden
158
+ * @private
159
+ */
160
+ private currentPage : PdfPage;
161
+ /**
162
+ * @hidden
163
+ * @private
164
+ */
165
+ private currentPageBounds : SizeF;
166
+ /**
167
+ * @hidden
168
+ * @private
169
+ */
170
+ private currentBounds : RectangleF;
171
+ /**
172
+ * @hidden
173
+ * @private
174
+ */
175
+ private listOfNavigatePages : number[] = [];
176
+ /**
177
+ * @hidden
178
+ * @private
179
+ */
180
+ private startLocation : PointF;
181
+ /**
182
+ * @hidden
183
+ * @private
184
+ */
185
+ private hType : PdfHorizontalOverflowType;
186
+ /**
187
+ * @hidden
188
+ * @private
189
+ */
190
+ private flag : boolean = true;
191
+ /**
192
+ * @hidden
193
+ * @private
194
+ */
195
+ private columnRanges : number[][] = [];
196
+ /**
197
+ * @hidden
198
+ * @private
199
+ */
200
+ private cellStartIndex : number;
201
+ /**
202
+ * @hidden
203
+ * @private
204
+ */
205
+ private cellEndIndex : number;
206
+ /**
207
+ * @hidden
208
+ * @private
209
+ */
210
+ private currentRowIndex : number;
211
+ /**
212
+ * @hidden
213
+ * @private
214
+ */
215
+ public static repeatRowIndex : number = -1;
216
+ /**
217
+ * @hidden
218
+ * @private
219
+ */
220
+ private isChanged : boolean;
221
+ /**
222
+ * @hidden
223
+ * @private
224
+ */
225
+ private currentLocation : PointF = new PointF(0, 0);
226
+ /**
227
+ * @hidden
228
+ * @private
229
+ */
230
+ private breakRow : boolean = true;
231
+ /**
232
+ * @hidden
233
+ * @private
234
+ */
235
+ private rowBreakPageHeightCellIndex : number;
236
+ private slr: PdfStringLayoutResult = null;
237
+ private remainderText: string = null;
238
+ private isPaginate: boolean = false;
239
+ //constructor
240
+ /**
241
+ * Initialize a new instance for `PdfGrid` class.
242
+ * @private
243
+ */
244
+ public constructor(baseFormat : PdfGrid) {
245
+ super(baseFormat);
246
+ }
247
+ //Properties
248
+ public get Grid() : PdfGrid {
249
+ return (this.elements as PdfGrid);
250
+ }
251
+ /**
252
+ * `Bounds` of the text.
253
+ * @private
254
+ */
255
+ private rectangle : RectangleF;
256
+ /**
257
+ * Pdf page `height`.
258
+ * @private
259
+ */
260
+ private gridHeight : number;
261
+ /**
262
+ * Specifies if [`isTabReplaced`].
263
+ * @private
264
+ */
265
+ private isTabReplaced : boolean;
266
+ /**
267
+ * `currentGraphics` of the text.
268
+ * @private
269
+ */
270
+ private currentGraphics : PdfGraphics;
271
+ /**
272
+ * Count of tab `occurance`.
273
+ * @private
274
+ */
275
+ private tabOccuranceCount : number;
276
+ /**
277
+ * Checks whether the x co-ordinate is need to set as client size or not.
278
+ * @hidden
279
+ * @private
280
+ */
281
+ private isOverloadWithPosition : boolean = false;
282
+ /**
283
+ * Stores client size of the page if the layout method invoked with `PointF` overload.
284
+ * @hidden
285
+ * @private
286
+ */
287
+ private clientSize : SizeF;
288
+ private gridLayoutFormat : PdfGridLayoutFormat;
289
+ private isHeader: boolean;
290
+ // Constructors
291
+ /**
292
+ * Initializes a new instance of the `StringLayouter` class.
293
+ * @private
294
+ */
295
+ //Public methods
296
+ /**
297
+ * `Layouts` the text.
298
+ * @private
299
+ */
300
+ /**
301
+ * `Layouts` the specified graphics.
302
+ * @private
303
+ */
304
+ /**
305
+ * `Layouts` the specified graphics.
306
+ * @private
307
+ */
308
+ /*public layout(graphics : PdfLayoutParams) : PdfLayoutResult
309
+ public layout(graphics : PdfGraphics, bounds : RectangleF) : void
310
+ public layout(graphics : PdfGraphics, bounds : PointF) : void
311
+ public layout(graphics ?: PdfGraphics | PdfLayoutParams, bounds ?: PointF | RectangleF) : void | PdfLayoutResult {
312
+ if (graphics instanceof PdfGraphics) {
313
+ if (bounds instanceof PointF) {
314
+ if (bounds.x === 0) {
315
+ bounds.x = PdfBorders.default.right.width / 2;
316
+ }
317
+ if (bounds.y === 0) {
318
+ bounds.y = PdfBorders.default.top.width / 2;
319
+ }
320
+ let boundaries : RectangleF = new RectangleF(bounds, new SizeF(0, 0));
321
+ this.layout(graphics, boundaries);
322
+ } else {
323
+ let width : number = graphics.clientSize.width;
324
+ let parameter : PdfLayoutParams = new PdfLayoutParams();
325
+ parameter.bounds = bounds;
326
+ this.currentGraphics = graphics;
327
+ if (graphics.layer != null) {
328
+ let index : number = 0;
329
+ if (this.currentGraphics.page instanceof PdfPage) {
330
+ index = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
331
+ } else {
332
+ index = (this.currentGraphics.page as PdfPageBase).defaultLayerIndex;
333
+ }
334
+ } else {
335
+ this.layoutInternal(parameter);
336
+ }
337
+ }
338
+ }
339
+ }*/
340
+ /**
341
+ * Gets the `format`.
342
+ * @private
343
+ */
344
+ private getFormat(format : PdfLayoutFormat) : PdfGridLayoutFormat {
345
+ let f : PdfGridLayoutFormat = format as PdfGridLayoutFormat;
346
+ return f;
347
+ }
348
+ /**
349
+ * `Layouts` the element.
350
+ * @private
351
+ */
352
+ protected layoutInternal(param : PdfLayoutParams) : PdfLayoutResult {
353
+ let format : PdfGridLayoutFormat = this.getFormat(param.format);
354
+ this.gridLayoutFormat = this.getFormat(param.format);
355
+ this.currentPage = param.page;
356
+ if (this.currentPage !== null) {
357
+ let pageHeight : number = this.currentPage.getClientSize().height;
358
+ let pageWidth : number = this.currentPage.getClientSize().width;
359
+ this.currentPageBounds = this.currentPage.getClientSize();
360
+ } else {
361
+ throw Error('Can not set page as null');
362
+ //this.currentPageBounds = this.currentGraphics.clientSize;
363
+ }
364
+ this.currentGraphics = this.currentPage.graphics;
365
+ //this.currentGraphics = (this.currentPage != null ) ? this.currentPage.graphics : this.currentGraphics;
366
+ // if (this.currentGraphics.layer !== null) {
367
+ // let index : number = 0;
368
+ // if (this.currentGraphics.page instanceof PdfPage) {
369
+ // index = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
370
+ // } else {
371
+ // index = (this.currentGraphics.page as PdfPageBase).defaultLayerIndex;
372
+ // }
373
+ // this.listOfNavigatePages.push(index);
374
+ // }
375
+ let index : number = 0;
376
+ index = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
377
+ this.listOfNavigatePages.push(index);
378
+ if (format != null && format.break === PdfLayoutBreakType.FitColumnsToPage) {
379
+ this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y),
380
+ new SizeF(this.Grid.columns.width, this.currentGraphics.clientSize.height));
381
+ } else {
382
+ this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y), this.currentGraphics.clientSize);
383
+ }
384
+ //this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y), this.currentGraphics.clientSize);
385
+ if (this.Grid.rows.count !== 0 ) {
386
+ this.currentBounds.width = (param.bounds.width > 0) ? param.bounds.width :
387
+ (this.currentBounds.width - this.Grid.rows.getRow(0).cells.getCell(0).style.borders.left.width / 2);
388
+ } else if (this.Grid.headers.count !== 0) {
389
+ // this.currentBounds.width = (param.bounds.width > 0) ? param.bounds.width : (this.currentBounds.width -
390
+ // this.Grid.headers.getHeader(0).cells.getCell(0).style.borders.left.width / 2);
391
+ this.currentBounds.width = param.bounds.width;
392
+ } else {
393
+ throw Error('Please add row or header into grid');
394
+ }
395
+ this.startLocation = new PointF(param.bounds.x, param.bounds.y);
396
+ // if (this.Grid.style.allowHorizontalOverflow && this.currentBounds.width > this.currentGraphics.clientSize.width) {
397
+ // this.currentBounds.width = this.currentGraphics.clientSize.width;
398
+ // this.currentBounds.width -= this.currentBounds.x;
399
+ // }
400
+ // if (this.Grid.isChildGrid) {
401
+ // this.childheight = param.bounds.height;
402
+ // }
403
+ // if (param.format !== null && param.format.usePaginateBounds) {
404
+ // if (param.format.paginateBounds.height > 0) {
405
+ // this.currentBounds.height = param.format.paginateBounds.height;
406
+ // }
407
+ //} else
408
+ if (param.bounds.height > 0 && !this.Grid.isChildGrid) {
409
+ this.currentBounds.height = param.bounds.height;
410
+ }
411
+ if (!this.Grid.isChildGrid) {
412
+ this.hType = this.Grid.style.horizontalOverflowType;
413
+ }
414
+ if (!this.Grid.style.allowHorizontalOverflow) {
415
+ this.columnRanges = [];
416
+ if (typeof this.Grid.isChildGrid !== 'undefined' && typeof this.Grid.isChildGrid) {
417
+ this.Grid.measureColumnsWidth(this.currentBounds);
418
+ } else {
419
+ this.Grid.measureColumnsWidth(new RectangleF(this.currentBounds.x, this.currentBounds.y, this.currentBounds.x + this.currentBounds.width, this.currentBounds.height));
420
+ }
421
+ this.columnRanges.push([0, this.Grid.columns.count - 1]);
422
+ } else {
423
+ this.Grid.measureColumnsWidth();
424
+ this.determineColumnDrawRanges();
425
+ }
426
+ if (this.Grid.hasRowSpanSpan) {
427
+ for ( let i: number = 0; i < this.Grid.rows.count; i++) {
428
+ if (this.Grid.rows.getRow(i).height !== -1 && !this.Grid.rows.getRow(i).isRowHeightSet) {
429
+ this.Grid.rows.getRow(i).isRowHeightSet = true;
430
+ }
431
+ }
432
+ }
433
+ let result : PdfGridLayoutResult = this.layoutOnPage(param);
434
+ return result;
435
+ }
436
+ // /* tslint:enable */
437
+ /**
438
+ * `Determines the column draw ranges`.
439
+ * @private
440
+ */
441
+ private determineColumnDrawRanges() : void {
442
+ let startColumn : number = 0;
443
+ let endColumn : number = 0;
444
+ let cellWidths : number = 0;
445
+ let availableWidth : number = this.currentGraphics.clientSize.width - this.currentBounds.x;
446
+ for (let i : number = 0; i < this.Grid.columns.count; i++) {
447
+ cellWidths += this.Grid.columns.getColumn(i).width;
448
+ if (cellWidths >= availableWidth) {
449
+ let subWidths : number = 0;
450
+ for (let j : number = startColumn; j <= i; j++) {
451
+ subWidths += this.Grid.columns.getColumn(j).width;
452
+ if (subWidths > availableWidth) {
453
+ break;
454
+ }
455
+ endColumn = j;
456
+ }
457
+ this.columnRanges.push([startColumn, endColumn]);
458
+ startColumn = endColumn + 1;
459
+ endColumn = startColumn;
460
+ cellWidths = (endColumn <= i) ? this.Grid.columns.getColumn(i).width : 0;
461
+ }
462
+ }
463
+ // if (startColumn !== this.columns.Count) {
464
+ this.columnRanges.push([startColumn, this.Grid.columns.count - 1 ]);
465
+ // }
466
+ }
467
+ /**
468
+ * `Layouts the on page`.
469
+ * @private
470
+ */
471
+ private layoutOnPage(param : PdfLayoutParams) : PdfGridLayoutResult {
472
+ /* tslint:disable */
473
+ this.pageBounds.x = param.bounds.x;
474
+ this.pageBounds.y = param.bounds.y;
475
+ this.pageBounds.height = param.bounds.height;
476
+ let format : PdfGridLayoutFormat = this.getFormat(param.format);
477
+ let endArgs : PdfGridEndPageLayoutEventArgs = null;
478
+ let result : PdfGridLayoutResult = null;
479
+ let layoutedPages : TemporaryDictionary<PdfPage, number[]> = new TemporaryDictionary<PdfPage, number[]>();
480
+ let startPage : PdfPage = param.page;
481
+ let isParentCell : boolean = false;
482
+ let cellBounds : number[] = [];
483
+ for (let index : number = 0; index < this.columnRanges.length; index++) {
484
+ let range : number[] = this.columnRanges[index];
485
+ this.cellStartIndex = range[0];
486
+ this.cellEndIndex = range[1];
487
+ let returnObject : {returnValue : boolean, currentBounds : RectangleF, currentRowIndex : number }
488
+ = this.raiseBeforePageLayout(this.currentPage, this.currentBounds, this.currentRowIndex);
489
+ this.currentBounds = returnObject.currentBounds;
490
+ this.currentRowIndex = returnObject.currentRowIndex;
491
+ // if (returnObject.returnValue) {
492
+ // result = new PdfGridLayoutResult(this.currentPage, this.currentBounds);
493
+ // break;
494
+ // }
495
+ //Draw Headers.
496
+ let drawHeader : boolean;
497
+ for (let i : number = 0; i < this.Grid.headers.count; i++) {
498
+ let row : PdfGridRow = this.Grid.headers.getHeader(i);
499
+ let headerHeight : number = this.currentBounds.y;
500
+ this.isHeader = true;
501
+ if (startPage != this.currentPage) {
502
+ for (let k: number = this.cellStartIndex; k <= this.cellEndIndex; k++) {
503
+ if (row.cells.getCell(k).isCellMergeContinue) {
504
+ row.cells.getCell(k).isCellMergeContinue = false;
505
+ row.cells.getCell(k).value = "";
506
+ }
507
+ }
508
+ }
509
+ // RowLayoutResult
510
+ let headerResult: RowLayoutResult = this.drawRow(row);
511
+ if (headerHeight === this.currentBounds.y) {
512
+ drawHeader = true;
513
+ if (PdfGridLayouter.repeatRowIndex === -1) {
514
+ PdfGridLayouter.repeatRowIndex = i;
515
+ }
516
+ } else {
517
+ drawHeader = false;
518
+ }
519
+ if (!headerResult.isFinish && startPage !== null
520
+ && format.layout !== PdfLayoutType.OnePage && drawHeader) {
521
+ this.startLocation.x = this.currentBounds.x;
522
+ this.currentPage = this.getNextPageformat(format);
523
+ this.startLocation.y = this.currentBounds.y;
524
+ if (typeof format.paginateBounds !== 'undefined' && format.paginateBounds.x === 0 && format.paginateBounds.y === 0 && format.paginateBounds.width === 0 && format.paginateBounds.height === 0)
525
+ this.currentBounds.x += this.startLocation.x;
526
+
527
+ this.drawRow(row);
528
+ }
529
+ this.isHeader = false;
530
+ }
531
+ let i : number = 0;
532
+ let length : number = this.Grid.rows.count;
533
+ let repeatRow : boolean;
534
+ let startingHeight : number = 0;
535
+ let flag : boolean = true;
536
+ //Here is to draw parent Grid and Cells
537
+ cellBounds = [];
538
+ //Draw row by row with the specified cell range.
539
+ for (let j : number = 0; j < this.Grid.rows.count; j++) {
540
+ let row : PdfGridRow = this.Grid.rows.getRow(j);
541
+ i++;
542
+ this.currentRowIndex = i - 1;
543
+ let originalHeight : number = this.currentBounds.y;
544
+ startPage = this.currentPage;
545
+ PdfGridLayouter.repeatRowIndex = -1;
546
+ if(flag && row.grid.isChildGrid)
547
+ {
548
+ startingHeight = originalHeight;
549
+ flag = false;
550
+ }
551
+ let rowResult : RowLayoutResult = null;
552
+ ///rowResult = this.drawRow(row);
553
+ /*if(!row.isrowFinish) {
554
+ if(!row.grid.isgridSplit){
555
+ rowResult = this.drawRow(row);
556
+ row.isrowFinish = true;
557
+ row.isrowDraw = true;
558
+ } else {
559
+ if(!row.isrowDraw){
560
+ rowResult = this.drawRow(row);
561
+ row.isrowFinish = true;
562
+ row.isrowDraw = true;
563
+ row.grid.isgridSplit = false;
564
+ } else {
565
+ rowResult = null;
566
+ break;
567
+ }
568
+ }
569
+ }
570
+ else {
571
+ //row.isrowFinish = false;
572
+ //rowResult = this.drawRow(row);
573
+ rowResult = null;
574
+ break;
575
+
576
+ } */
577
+ if(this.Grid.splitChildRowIndex == -1){
578
+ rowResult = this.drawRow(row);
579
+ row.isrowFinish = true;
580
+ }
581
+ else {
582
+ if(row.grid.ParentCell.row.grid.isGridSplit && this.Grid.splitChildRowIndex <= row.rowIndex){
583
+ rowResult = this.drawRow(row);
584
+ row.isrowFinish = true;
585
+ } else if(row.isrowFinish) {
586
+ continue;
587
+ }else{
588
+ break;
589
+ }
590
+
591
+ }
592
+ //rowResult = this.drawRow(row);
593
+ cellBounds.push(rowResult.bounds.width);
594
+ /*if (row.isRowBreaksNextPage)
595
+ {
596
+ let x : number = 0;
597
+ for (let l : number = 0; l < row.cells.count; l++)
598
+ {
599
+ let isNestedRowBreak : boolean = false;
600
+ if (row.height == row.cells.getCell(l).height)
601
+ {
602
+ let n : number;
603
+ let grid : PdfGrid = row.cells.getCell(l).value as PdfGrid;
604
+ for (let m : number = grid.rows.count; 0 < m; m--)
605
+ {
606
+ if ((grid.rows.getRow(m - 1).rowBreakHeight > 0))
607
+ {
608
+ isNestedRowBreak = true;
609
+ break;
610
+ }
611
+ if (grid.rows.getRow(m - 1).isRowBreaksNextPage)
612
+ {
613
+ row.rowBreakHeightValue = grid.rows.getRow(m - 1).rowBreakHeightValue;
614
+ break;
615
+ }
616
+ row.rowBreakHeightValue += grid.rows.getRow(m - 1).height;
617
+ }
618
+ }
619
+ if (isNestedRowBreak)
620
+ break;
621
+ }
622
+ for (let j : number = 0; j < row.cells.count; j++)
623
+ {
624
+
625
+ if (row.height > row.cells.getCell(j).height)
626
+ {
627
+ row.cells.getCell(j).value = " ";
628
+ let rect : RectangleF ;
629
+ let page : PdfPage = this.getNextPage(this.currentPage);
630
+ let section : PdfSection = this.currentPage.section;
631
+ let index : number = section.indexOf(page);
632
+ for (let k : number = 0; k < (section.count - 1) - index; k++)
633
+ {
634
+ rect = new RectangleF(x, 0, row.grid.columns.getColumn(j).width, page.getClientSize().height);
635
+ PdfGridLayouter.repeatRowIndex = -1;
636
+ row.cells.getCell(j).draw(page.graphics, rect, false);
637
+ page = this.getNextPage(page);
638
+ }
639
+ rect = new RectangleF(x, 0, row.grid.columns.getColumn(j).width, row.rowBreakHeightValue);
640
+
641
+ row.cells.getCell(j).draw(page.graphics, rect, false);
642
+ }
643
+ x += row.grid.columns.getColumn(j).width;
644
+ }
645
+ }*/
646
+ //if height remains same, it is understood that row is not drawn in the page
647
+ if (originalHeight === this.currentBounds.y) {
648
+ repeatRow = true;
649
+ PdfGridLayouter.repeatRowIndex = this.Grid.rows.rowCollection.indexOf(row);
650
+ } else {
651
+ repeatRow = false;
652
+ PdfGridLayouter.repeatRowIndex = -1;
653
+ }
654
+ while (!rowResult.isFinish && startPage != null)
655
+ {
656
+ let tempResult : PdfGridLayoutResult = this.getLayoutResult();
657
+ /*if (startPage != this.currentPage)
658
+ {
659
+ if (row.grid.isChildGrid && row.grid.ParentCell != null)
660
+ {
661
+ let bounds : RectangleF= new RectangleF(new PointF(format.paginateBounds.x,format.paginateBounds.y), new SizeF(param.bounds.width, tempResult.bounds.height));
662
+ bounds.x += param.bounds.x;
663
+ if (row.grid.ParentCell.row.grid.style.cellPadding != null)
664
+ {
665
+ bounds.y += row.grid.ParentCell.row.grid.style.cellPadding.top;
666
+ if (bounds.height > this.currentPageBounds.height)
667
+ {
668
+ bounds.height = this.currentPageBounds.height - bounds.y;
669
+ bounds.height -= (row.grid.ParentCell.row.grid.style.cellPadding.bottom);
670
+ }
671
+ }
672
+ // Draw border for cells in the nested grid cell's row.
673
+ for (let c : number = 0; c < row.cells.count; c++)
674
+ {
675
+ let cell : PdfGridCell = row.cells.getCell(c);
676
+ let cellWidth : number= 0;
677
+ if (cell.columnSpan > 1)
678
+ {
679
+ for (; c < cell.columnSpan; c++)
680
+ cellWidth += row.grid.columns.getColumn(c).width;
681
+ }
682
+ else
683
+ cellWidth = Math.max(cell.width, row.grid.columns.getColumn(c).width);
684
+ cell.drawCellBorders(this.currentGraphics, new RectangleF(new PointF(bounds.x,bounds.y), new SizeF(cellWidth, bounds.height)));
685
+ bounds.x += cellWidth;
686
+ c += (cell.columnSpan - 1);
687
+ }
688
+ }
689
+ }
690
+ */
691
+ endArgs = this.raisePageLayouted(tempResult);
692
+ if (endArgs.cancel || repeatRow)
693
+ break;
694
+ else if (this.Grid.allowRowBreakAcrossPages )
695
+ {
696
+ //If there is no space in the current page, add new page and then draw the remaining row.
697
+ this.currentPage = this.getNextPageformat(format);
698
+ originalHeight = this.currentBounds.y;
699
+ let location : PointF = new PointF(PdfBorders.default.right.width / 2, PdfBorders.default.top.width / 2);
700
+ if ((format.paginateBounds.x === 0 && format.paginateBounds.y === 0 && format.paginateBounds.width === 0 &&
701
+ format.paginateBounds.height === 0 ) && (this.startLocation.x === location.x && this.startLocation.y === location.y)) {
702
+ this.currentBounds.x += this.startLocation.x;
703
+ this.currentBounds.y += this.startLocation.y;
704
+ }
705
+ if (this.isPaginate) {
706
+ this.startLocation.y = this.currentBounds.y;
707
+ this.isPaginate = false;
708
+ }
709
+ if (this.Grid.isChildGrid && row.grid.ParentCell != null)
710
+ {
711
+ if (this.Grid.ParentCell.row.grid.style.cellPadding != null)
712
+ {
713
+ if (row.rowBreakHeight + this.Grid.ParentCell.row.grid.style.cellPadding.top < this.currentBounds.height)
714
+ {
715
+ this.currentBounds.y = this.Grid.ParentCell.row.grid.style.cellPadding.top;
716
+ }
717
+ }
718
+ }
719
+
720
+ if (row.grid.ParentCell != null)
721
+ {
722
+ row.grid.ParentCell.row.isRowBreaksNextPage = true;
723
+ row.grid.ParentCell.row.rowBreakHeightValue = row.rowBreakHeight + this.Grid.ParentCell.row.grid.style.cellPadding.top + this.Grid.ParentCell.row.grid.style.cellPadding.bottom;
724
+
725
+ for ( let i : number = row.rowIndex + 1; i<row.grid.rows.count;i++){
726
+ row.grid.ParentCell.row.rowBreakHeightValue += row.grid.rows.getRow(i).height;
727
+ }
728
+ //row.rowBreakHeight = row.grid.ParentCell.row.rowBreakHeightValue;
729
+ }
730
+
731
+ /*if (row.noOfPageCount > 1)
732
+ {
733
+ let temp : number = row.rowBreakHeightValue;
734
+ for (let j : number = 1; j < row.noOfPageCount; j++)
735
+ {
736
+ row.rowBreakHeightValue = 0;
737
+ row.height = ((row.noOfPageCount - 1) * this.currentPage.getClientSize().height);
738
+ this.drawRow(row);
739
+ this.currentPage = this.getNextPageformat(format);
740
+ startPage = this.currentPage;
741
+ }
742
+ row.rowBreakHeightValue = temp;
743
+ row.noOfPageCount = 1;
744
+ rowResult = this.drawRow(row);
745
+ } else {
746
+ rowResult = this.drawRow(row);
747
+ }
748
+ /*if(row.grid.isChildGrid){
749
+ row.isrowFinish = false;
750
+ row.isrowDraw = false;
751
+ row.grid.isgridSplit = true;
752
+ row.grid.ParentCell.row.grid.isgridSplit = true;
753
+ //rowResult.isFinish = false;
754
+ break;
755
+ }*/
756
+
757
+ if(row.grid.isChildGrid){
758
+ //row.grid.isgridSplit = true;
759
+ row.isrowFinish = false;
760
+ //row.grid.ParentCell.row.grid.isgridSplit = true;
761
+ row.grid.splitChildRowIndex = row.rowIndex;
762
+ row.grid.ParentCell.row.grid.splitChildRowIndex = row.grid.ParentCell.row.rowIndex;
763
+ if(row.grid.ParentCell.row.grid.isGridSplit)
764
+ {
765
+ row.grid.ParentCell.row.noOfPageCount+= 1;
766
+ row.grid.ParentCell.row.grid.isGridSplit = false;
767
+ }
768
+ break;
769
+ }
770
+ if (row.noOfPageCount <1)
771
+ {
772
+ if(row.grid.splitChildRowIndex != -1){
773
+ row.grid.isGridSplit = true;
774
+ }
775
+ if (row.style.border != null && ((row.style.border.left != null && row.style.border.left.width !== 1)
776
+ || (row.style.border.top != null && row.style.border.top.width !== 1))) {
777
+ let x : number = row.style.border.left.width / 2;
778
+ let y : number = row.style.border.top.width / 2;
779
+ if (this.currentBounds.x === PdfBorders.default.right.width / 2 && this.currentBounds.y === PdfBorders.default.right.width / 2) {
780
+ let newBound : RectangleF = new RectangleF(x, y, this.currentBounds.width, this.currentBounds.height);
781
+ this.currentBounds = newBound;
782
+ }
783
+ }
784
+ if (this.Grid.repeatHeader) {
785
+ for (let j : number = 0; j < this.Grid.headers.count; j++) {
786
+ let headerRepeat : PdfGridRow = this.Grid.headers.getHeader(j);
787
+ this.drawRow(headerRepeat);
788
+ }
789
+ }
790
+ rowResult = this.drawRow(row);
791
+ if(row.noOfPageCount >= 1){
792
+ let temp : number = row.rowBreakHeightValue;
793
+ for (let j : number = 0; j < row.noOfPageCount; j++)
794
+ {
795
+ //this.currentPage.section.add();
796
+ let tempResult1 : PdfGridLayoutResult = this.getLayoutResult();
797
+ endArgs = this.raisePageLayouted(tempResult1);
798
+
799
+ this.currentPage = this.getNextPageformat(format);
800
+ originalHeight = this.currentBounds.y;
801
+ //row.rowBreakHeightValue = 0;
802
+ if(row.grid.splitChildRowIndex != -1){
803
+ row.grid.isGridSplit = true;
804
+ }
805
+ this.currentBounds.y = 0.5;
806
+ if (this.Grid.repeatHeader) {
807
+ for (let i : number = 0; i < this.Grid.headers.count; i++) {
808
+ let header : PdfGridRow = this.Grid.headers.getHeader(i);
809
+ this.drawRow(header);
810
+ }
811
+ }
812
+ //row.height = ((row.noOfPageCount - 1) * this.currentPage.getClientSize().height);
813
+ this.drawRow(row);
814
+
815
+ }
816
+ // row.rowBreakHeight = temp;
817
+ // row.noOfPageCount = 1;
818
+ // rowResult = this.drawRow(row);
819
+ }
820
+ row.grid.splitChildRowIndex = -1;
821
+ row.grid.isGridSplit = false;
822
+ rowResult.isFinish = this.checkIsFisished(row);
823
+ //row.NestedGridLayoutResult.bounds.height = row.rowBreakHeightValue;
824
+ //this.currentBounds.y = rowResult.bounds.y;
825
+ for(let i : number = 0; i<row.cells.count;i++){
826
+ if(row.cells.getCell(i).value instanceof PdfGrid){
827
+ (row.cells.getCell(i).value as PdfGrid).splitChildRowIndex = -1; }
828
+ }
829
+ }
830
+
831
+ }
832
+ // else if (!this.Grid.allowRowBreakAcrossPages && i < length)
833
+ // {
834
+ // this.currentPage = this.getNextPageformat(format);
835
+ // break;
836
+ // }
837
+ // else if (i >= length)
838
+ // break;
839
+ }
840
+ if (!rowResult.isFinish && startPage !== null && format.layout !== PdfLayoutType.OnePage && repeatRow) {
841
+ // During pagination, cell position is maintained here.
842
+ this.startLocation.x = this.currentBounds.x;
843
+ let isAddNextPage : boolean = false;
844
+ this.currentPage = this.getNextPageformat(format);
845
+ /*if (!this.Grid.isSingleGrid)
846
+ {
847
+ for ( let j : number= 0; j < this.Grid.rows.count; j++)
848
+ {
849
+ let isWidthGreaterthanParent : boolean = false;
850
+ for (let k : number = 0; k < this.Grid.rows.getRow(j).cells.count; k++)
851
+ {
852
+ if (this.Grid.rows.getRow(j).cells.getCell(k).width > this.currentPageBounds.width)
853
+ isWidthGreaterthanParent = true;
854
+ }
855
+ if (isWidthGreaterthanParent && this.Grid.rows.getRow(j).cells.getCell(this.rowBreakPageHeightCellIndex).pageCount > 0)
856
+ {
857
+ isAddNextPage = true;
858
+ }
859
+ }
860
+ }
861
+ if (!this.Grid.isRearranged && isAddNextPage)
862
+ {
863
+ let section : PdfSection = this.currentPage.section;
864
+
865
+ //this.currentPage = section.add();
866
+
867
+ this.currentGraphics = this.currentPage.graphics;
868
+ this.currentBounds = new RectangleF(new PointF(0,0), this.currentPage.getClientSize());
869
+
870
+ let pageindex : number = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
871
+ }
872
+ else
873
+ {
874
+ this.currentPage = this.getNextPageformat(format);
875
+ }
876
+ if (format.paginateBounds.y == 0)
877
+ this.currentBounds.y = PdfBorders.default.top.width/2;
878
+ else
879
+ {
880
+ this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
881
+
882
+ }*/
883
+ if (this.raiseBeforePageLayout(this.currentPage, this.currentBounds, this.currentRowIndex).returnValue) {
884
+ break;
885
+ }
886
+ if ((param.format !== null) && !param.format.usePaginateBounds && param.bounds !== null &&
887
+ param.bounds.height > 0 && !this.Grid.isChildGrid) {
888
+ this.currentBounds.height = param.bounds.height;
889
+ }
890
+ if (typeof param.format !== 'undefined' && param.format != null && typeof param.format.usePaginateBounds !== 'undefined' && !param.format.usePaginateBounds && !(param.format.paginateBounds.x === 0 && param.format.paginateBounds.y === 0 && param.format.paginateBounds.width === 0 && param.format.paginateBounds.height === 0) && param.format.paginateBounds.y === 0) {
891
+ this.currentBounds.y = PdfBorders.default.top.width / 2;
892
+ } else {
893
+ this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
894
+ if (format != null && (format.paginateBounds.x !== 0 || format.paginateBounds.y !== 0 || format.paginateBounds.height !== 0 || format.paginateBounds.width !== 0)) {
895
+ this.currentBounds.x = format.paginateBounds.x;
896
+ this.currentBounds.width = format.paginateBounds.width;
897
+ this.currentBounds.height = format.paginateBounds.height;
898
+ }
899
+ }
900
+ if (typeof param.format !== 'undefined' && (param.format !== null) && typeof param.format.usePaginateBounds !== 'undefined' && !param.format.usePaginateBounds && param.bounds !== null &&
901
+ param.bounds.y > 0 && !this.Grid.isChildGrid) {
902
+ this.currentBounds.y = param.bounds.y;
903
+ }
904
+ this.startLocation.y = this.currentBounds.y;
905
+ if ((format.paginateBounds.x === format.paginateBounds.y) &&
906
+ (format.paginateBounds.y === format.paginateBounds.height) &&
907
+ (format.paginateBounds.height === format.paginateBounds.width) && (format.paginateBounds.width === 0)) {
908
+ this.currentBounds.x += this.startLocation.x;
909
+ }
910
+ if (this.currentBounds.x === PdfBorders.default.left.width / 2 ) {
911
+ this.currentBounds.y += this.startLocation.x;
912
+ }
913
+ if (this.Grid.repeatHeader) {
914
+ for (let i : number = 0; i < this.Grid.headers.count; i++) {
915
+ let header : PdfGridRow = this.Grid.headers.getHeader(i);
916
+ this.drawRow(header);
917
+ }
918
+ }
919
+ this.drawRow(row);
920
+ if (this.currentPage !== null && !layoutedPages.containsKey(this.currentPage)) {
921
+ layoutedPages.add(this.currentPage, range);
922
+ }
923
+ }
924
+ if (row.NestedGridLayoutResult != null)
925
+ {
926
+ // Position for next row in the grid.
927
+ this.currentPage = row.NestedGridLayoutResult.page;
928
+ this.currentGraphics = this.currentPage.graphics; //If not, next row will not be drawn in the layouted page.
929
+ this.startLocation = new PointF(row.NestedGridLayoutResult.bounds.x,row.NestedGridLayoutResult.bounds.y);
930
+ let recalHeight : number = this.ReCalculateHeight(row,row.NestedGridLayoutResult.bounds.height);
931
+ this.currentBounds.y = recalHeight;
932
+ //this.currentBounds.y = row.NestedGridLayoutResult.bounds.height;
933
+ if (startPage != this.currentPage)
934
+ {
935
+ let secion : PdfSection= this.currentPage.section;
936
+ let startIndex : number = secion.indexOf(startPage) + 1;
937
+ let endIndex : number = secion.indexOf(this.currentPage);
938
+
939
+ for (let page : number = startIndex; page < endIndex + 1; page++)
940
+ {
941
+ let pageGraphics : PdfGraphics = this.currentPage.graphics;
942
+ let location : PointF = new PointF(format.paginateBounds.x,format.paginateBounds.y);
943
+
944
+ let height : number = page == endIndex ? (row.NestedGridLayoutResult.bounds.height-param.bounds.y) :
945
+ (this.currentBounds.height - location.y);
946
+ if (height <= pageGraphics.clientSize.height)
947
+ height += param.bounds.y;
948
+ // if (row.grid.isChildGrid && row.grid.ParentCell != null)
949
+ // location.x += param.bounds.x;
950
+ location.y = format == null ? 0.5 : format.paginateBounds.y;
951
+
952
+ // Draw border for last paginated row containing nested grid.
953
+ for (let c : number = 0; c < row.cells.count; c++)
954
+ {
955
+ let cell : PdfGridCell = row.cells.getCell(c);
956
+ let cellWidth : number = 0;
957
+ let totalwidth : number = 0;
958
+ if (cell.value instanceof PdfGrid)
959
+ {
960
+ for(let i : number =0 ; i < cell.value.columns.count; i++)
961
+ {
962
+ totalwidth += cell.value.columns.getColumn(i).columnWidth;
963
+ }
964
+ } else {
965
+ totalwidth = cell.width;
966
+ }
967
+ // if (cell.columnSpan > 1)
968
+ // {
969
+ // for (; c < cell.columnSpan; c++)
970
+ // cellWidth += row.grid.columns.getColumn(c).width;
971
+ // }
972
+ // else
973
+ cellWidth = Math.max(totalwidth, row.grid.columns.getColumn(c).width);
974
+
975
+ cell.drawCellBorders(pageGraphics, new RectangleF(location, new SizeF(cellWidth, height)));
976
+ location.x += cellWidth;
977
+ c += (cell.columnSpan - 1);
978
+ }
979
+ }
980
+
981
+ // So, nested grid drawing is completed for the current row. Update page.
982
+ // Otherwise, the next nested grid of the parent will draw borders from start.
983
+ startPage = this.currentPage;
984
+ }
985
+ }
986
+ }
987
+ let isPdfGrid : boolean = false;
988
+ let maximumCellBoundsWidth : number = 0;
989
+ if (cellBounds.length > 0) {
990
+ maximumCellBoundsWidth = cellBounds[0];
991
+ }
992
+ let largeNavigatePage : number[][] = [[1, 2]];
993
+ for ( let c:number = 0; c < this.Grid.rows.count; c++)
994
+ {
995
+
996
+ if (this.cellEndIndex != -1 && this.Grid.rows.getRow(c).cells.getCell(this.cellEndIndex).value instanceof PdfGrid)
997
+ {
998
+ let grid: PdfGrid = this.Grid.rows.getRow(c).cells.getCell(this.cellEndIndex).value as PdfGrid;
999
+ this.rowLayoutBoundsWidth= grid.rowLayoutBoundsWidth;
1000
+ isPdfGrid = true;
1001
+ // if (largeNavigatePage[0][0] < grid.listOfNavigatePages.length)
1002
+ // {
1003
+ // largeNavigatePage[0][0] = grid.listOfNavigatePages.length;
1004
+ // largeNavigatePage[0][1] = cellBounds[c];
1005
+ // }
1006
+ // else if ((largeNavigatePage[0][0] == grid.listOfNavigatePages.length) && (largeNavigatePage[0][1] < cellBounds[c]))
1007
+ // {
1008
+ // largeNavigatePage[0][1] = cellBounds[c];
1009
+ // }
1010
+
1011
+ }
1012
+ }
1013
+ if (!isPdfGrid && cellBounds.length > 0) {
1014
+ for (let c : number = 0; c < i - 1; c++) {
1015
+ if (maximumCellBoundsWidth < cellBounds[c]) {
1016
+ maximumCellBoundsWidth = cellBounds[c];
1017
+ }
1018
+ }
1019
+ this.rowLayoutBoundsWidth = maximumCellBoundsWidth;
1020
+ } else {
1021
+ this.rowLayoutBoundsWidth = largeNavigatePage[0][1];
1022
+ }
1023
+ if (this.columnRanges.indexOf(range) < this.columnRanges.length - 1
1024
+ && startPage != null && format.layout != PdfLayoutType.OnePage) {
1025
+ isParentCell = this.Grid.isChildGrid;
1026
+
1027
+ if ((largeNavigatePage[0] [0] as Number )!= 0)
1028
+ {
1029
+ let section : PdfSection = this.currentPage.section;
1030
+ let pageIndex : number = section.indexOf(this.currentPage);
1031
+
1032
+ this.currentGraphics = this.currentPage.graphics;
1033
+ this.currentBounds = new RectangleF(new PointF(0,0), this.currentPage.getClientSize());
1034
+ let pageindex : Number = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
1035
+ }
1036
+ else
1037
+ {
1038
+ this.currentPage = this.getNextPageformat(format);
1039
+ }
1040
+
1041
+ // let locationGrid : PointF= new PointF(PdfBorders.default.right.width / 2, PdfBorders.default.top.width / 2);
1042
+ // if (format.paginateBounds == new RectangleF(0,0,0,0) && this.startLocation == locationGrid)
1043
+ // {
1044
+ // this.currentBounds.x += this.startLocation.x;
1045
+ // this.currentBounds.y += this.startLocation.y;
1046
+ // }
1047
+ }
1048
+ if (this.columnRanges.length-1 !== index && this.columnRanges.length > 1 && format.layout !== PdfLayoutType.OnePage) {
1049
+ this.currentPage = this.getNextPageformat(format);
1050
+ if ((format.paginateBounds.x === format.paginateBounds.y) && (format.paginateBounds.y === format.paginateBounds.height)
1051
+ && (format.paginateBounds.height === format.paginateBounds.width) && (format.paginateBounds.width === 0)) {
1052
+ this.currentBounds.x += this.startLocation.x;
1053
+ this.currentBounds.y += this.startLocation.y;
1054
+ //this.currentBounds.height = this.pageBounds.height;
1055
+ }
1056
+ }
1057
+
1058
+ }
1059
+ result = this.getLayoutResult();
1060
+ if (this.Grid.style.allowHorizontalOverflow && this.Grid.style.horizontalOverflowType == PdfHorizontalOverflowType.NextPage) {
1061
+ this.reArrangePages(layoutedPages);
1062
+ }
1063
+ this.raisePageLayouted(result);
1064
+ return result;
1065
+ }
1066
+ private checkIsFisished(row: PdfGridRow): boolean {
1067
+ let result: boolean = true;
1068
+ for (let i: number = 0; i < row.cells.count; i++) {
1069
+ if (!row.cells.getCell(i).FinishedDrawingCell) {
1070
+ result = false;
1071
+ }
1072
+ }
1073
+ return result;
1074
+ }
1075
+ /* tslint:enable */
1076
+ /**
1077
+ * Gets the `next page`.
1078
+ * @private
1079
+ */
1080
+ public getNextPageformat(format : PdfLayoutFormat) : PdfPage {
1081
+ let section : PdfSection = this.currentPage.section;
1082
+ let nextPage : PdfPage = null;
1083
+ let index : number = section.indexOf(this.currentPage);
1084
+ this.flag = false;
1085
+ if (index === section.count - 1) {
1086
+ nextPage = (section.add() as PdfPage);
1087
+ } else {
1088
+ nextPage = (section.getPages()[index + 1] as PdfPage);
1089
+ }
1090
+ this.currentGraphics = nextPage.graphics;
1091
+ let pageindex : number = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
1092
+ if (!(this.listOfNavigatePages.indexOf(pageindex) !== -1)) {
1093
+ this.listOfNavigatePages.push(pageindex);
1094
+ }
1095
+ this.currentBounds = new RectangleF(new PointF(0, 0), nextPage.getClientSize());
1096
+ if ((typeof format !== 'undefined') && format != null && format.usePaginateBounds && (typeof format.paginateBounds !== 'undefined') && format.paginateBounds != null && (format.paginateBounds.x !== format.paginateBounds.y) && (format.paginateBounds.y !== format.paginateBounds.height)
1097
+ && (format.paginateBounds.height !== format.paginateBounds.width) && (format.paginateBounds.width !== 0)) {
1098
+ this.currentBounds.x = format.paginateBounds.x;
1099
+ this.currentBounds.y = format.paginateBounds.y;
1100
+ this.currentBounds.height = format.paginateBounds.height;
1101
+ }
1102
+ return nextPage;
1103
+ }
1104
+ private CheckIfDefaultFormat(format : PdfStringFormat) : boolean {
1105
+ let defaultFormat : PdfStringFormat = new PdfStringFormat();
1106
+ return (format.alignment === defaultFormat.alignment && format.characterSpacing === defaultFormat.characterSpacing &&
1107
+ format.clipPath === defaultFormat.clipPath && format.firstLineIndent === defaultFormat.firstLineIndent &&
1108
+ format.horizontalScalingFactor === defaultFormat.horizontalScalingFactor &&
1109
+ format.lineAlignment === defaultFormat.lineAlignment
1110
+ && format.lineLimit === defaultFormat.lineLimit && format.lineSpacing === defaultFormat.lineSpacing &&
1111
+ format.measureTrailingSpaces === defaultFormat.measureTrailingSpaces && format.noClip === defaultFormat.noClip &&
1112
+ format.paragraphIndent === defaultFormat.paragraphIndent && format.rightToLeft === defaultFormat.rightToLeft &&
1113
+ format.subSuperScript === defaultFormat.subSuperScript && format.wordSpacing === defaultFormat.wordSpacing &&
1114
+ format.wordWrap === defaultFormat.wordWrap);
1115
+ }
1116
+ /**
1117
+ * `Raises BeforeCellDraw event`.
1118
+ * @private
1119
+ */
1120
+ private RaiseBeforeCellDraw(graphics : PdfGraphics, rowIndex : number, cellIndex : number, bounds : RectangleF,
1121
+ value : string, style : PdfGridCellStyle ) : PdfGridCellStyle {
1122
+ let args : PdfGridBeginCellDrawEventArgs = null;
1123
+ if (this.Grid.raiseBeginCellDraw) {
1124
+ args = new PdfGridBeginCellDrawEventArgs(graphics, rowIndex, cellIndex, bounds, value, style);
1125
+ this.Grid.onBeginCellDraw(args);
1126
+ style = args.style;
1127
+ }
1128
+ return style;
1129
+ }
1130
+ /**
1131
+ * `Raises AfterCellDraw event`.
1132
+ * @private
1133
+ */
1134
+ private raiseAfterCellDraw(graphics : PdfGraphics, rowIndex : number, cellIndex : number,
1135
+ bounds : RectangleF, value : string, cellstyle : PdfGridCellStyle) : void {
1136
+ let args : PdfGridEndCellDrawEventArgs = null;
1137
+ if (this.Grid.raiseEndCellDraw) {
1138
+ args = new PdfGridEndCellDrawEventArgs(graphics, rowIndex, cellIndex, bounds, value, cellstyle);
1139
+ this.Grid.onEndCellDraw(args);
1140
+ }
1141
+ }
1142
+ private reArrangePages(layoutedPages : TemporaryDictionary<PdfPage, number[]>) : void {
1143
+ let document : PdfDocument = this.currentPage.document;
1144
+ let pages : PdfPage[] = [];
1145
+ let keys : PdfPage[] = layoutedPages.keys();
1146
+ let values : number[][] = layoutedPages.values();
1147
+ for (let i : number = 0; i < keys.length; i++) {
1148
+ let page : PdfPage = keys[i] as PdfPage;
1149
+ page.section = null;
1150
+ pages.push(page);
1151
+ document.pages.remove(page);
1152
+ }
1153
+ /* tslint:disable */
1154
+ for (let i : number = 0; i < layoutedPages.size(); i++) {
1155
+ let count : number = 0;
1156
+ for (let j : number = i, count = (layoutedPages.size() / this.columnRanges.length); j < layoutedPages.size(); j += count) {
1157
+ let page : PdfPage = pages[j];
1158
+ if (typeof page !== 'undefined' && document.pages.indexOf(page) === -1) {
1159
+ document.pages.add(page);
1160
+ }
1161
+ }
1162
+ }
1163
+ /* tslint:enable */
1164
+ }
1165
+ /**
1166
+ * Gets the `layout result`.
1167
+ * @private
1168
+ */
1169
+ private getLayoutResult() : PdfGridLayoutResult {
1170
+ if (this.Grid.isChildGrid && this.Grid.allowRowBreakAcrossPages) {
1171
+ for (let i : number = 0; i < this.Grid.rows.count; i++) {
1172
+ let row : PdfGridRow = this.Grid.rows.getRow(i);
1173
+ if (row.rowBreakHeight > 0 && row.repeatFlag) {
1174
+ this.startLocation.y = this.currentPage.origin.y;
1175
+ }
1176
+ }
1177
+ }
1178
+ let bounds : RectangleF;
1179
+ if (!this.isChanged) {
1180
+ bounds = new RectangleF(this.startLocation, new SizeF(this.currentBounds.width, this.currentBounds.y -
1181
+ this.startLocation.y));
1182
+ }
1183
+ // else {
1184
+ // bounds = new RectangleF(this.currentLocation, new SizeF(this.currentBounds.width, this.currentBounds.y -
1185
+ // this.currentLocation.y));
1186
+ // }
1187
+ /* tslint:enable */
1188
+ return new PdfGridLayoutResult(this.currentPage, bounds);
1189
+ }
1190
+ /**
1191
+ * `Recalculate row height` for the split cell to be drawn.
1192
+ * @private
1193
+ */
1194
+ public ReCalculateHeight(row : PdfGridRow, height : number) : number {
1195
+ let newHeight : number = 0.0;
1196
+ for (let i : number = this.cellStartIndex; i <= this.cellEndIndex; i++) {
1197
+ if (!(row.cells.getCell(i).remainingString === null || row.cells.getCell(i).remainingString === '' ||
1198
+ typeof row.cells.getCell(i).remainingString === 'undefined')) {
1199
+ newHeight = Math.max(newHeight, row.cells.getCell(i).measureHeight());
1200
+ }
1201
+ }
1202
+ return Math.max(height, newHeight);
1203
+ }
1204
+ /**
1205
+ * `Raises BeforePageLayout event`.
1206
+ * @private
1207
+ */
1208
+ private raiseBeforePageLayout(currentPage : PdfPage, currentBounds : RectangleF,
1209
+ currentRow : number) : { returnValue : boolean, currentBounds : RectangleF,
1210
+ currentRowIndex : number } {
1211
+ let cancel : boolean = false;
1212
+ if (this.Grid.raiseBeginPageLayout) {
1213
+ let args : PdfGridBeginPageLayoutEventArgs = new PdfGridBeginPageLayoutEventArgs( currentBounds, currentPage, currentRow);
1214
+ this.Grid.onBeginPageLayout(args);
1215
+ // if (currentBounds !== args.Bounds) {
1216
+ // this.isChanged = true;
1217
+ // this.currentLocation = new PointF(args.Bounds.x, args.Bounds.y);
1218
+ // this.measureColumnsWidth(new RectangleF(new PointF(args.Bounds.x, args.Bounds.y) ,
1219
+ // new SizeF(args.Bounds.width + args.Bounds.x ,
1220
+ // args.Bounds.height)));
1221
+ // }
1222
+ cancel = (typeof args.cancel === 'undefined' ? false : args.cancel);
1223
+ currentBounds = args.bounds;
1224
+ currentRow = args.startRowIndex;
1225
+ }
1226
+ return {returnValue : cancel, currentBounds : currentBounds, currentRowIndex : currentRow };
1227
+ }
1228
+ /**
1229
+ * `Raises PageLayout event` if needed.
1230
+ * @private
1231
+ */
1232
+ private raisePageLayouted(result : PdfLayoutResult) : PdfGridEndPageLayoutEventArgs {
1233
+ let args : PdfGridEndPageLayoutEventArgs = new PdfGridEndPageLayoutEventArgs(result);
1234
+ if (this.Grid.raiseEndPageLayout) {
1235
+ this.Grid.onEndPageLayout(args);
1236
+ }
1237
+ return args;
1238
+ }
1239
+ private drawRow(row : PdfGridRow) : RowLayoutResult
1240
+ /**
1241
+ * `Draws row`
1242
+ * @private
1243
+ */
1244
+ private drawRow(row : PdfGridRow, result : RowLayoutResult, height : number) : void
1245
+ private drawRow(row : PdfGridRow, result ?: RowLayoutResult, height ?: number) : RowLayoutResult|void {
1246
+ if (typeof result === 'undefined') {
1247
+ //.. Check if required space available.
1248
+ //.....If the row conains spans which falls through more than one page, then draw the row to next page.
1249
+ let result : RowLayoutResult = new RowLayoutResult();
1250
+ let rowHeightWithSpan : number = 0;
1251
+ let location : PointF = new PointF(0, 0);
1252
+ let size : SizeF = new SizeF(0, 0);
1253
+ let isHeader : boolean = false;
1254
+ if (row.rowSpanExists) {
1255
+ let maxSpan : number = 0;
1256
+ let currRowIndex : number = this.Grid.rows.rowCollection.indexOf(row);
1257
+ if (currRowIndex === -1) {
1258
+ currRowIndex = this.Grid.headers.indexOf(row);
1259
+ if (currRowIndex !== -1) {
1260
+ isHeader = true;
1261
+ }
1262
+ }
1263
+ for (let i : number = 0; i < row.cells.count; i++) {
1264
+ let cell : PdfGridCell = row.cells.getCell(i);
1265
+ maxSpan = Math.max(maxSpan, cell.rowSpan);
1266
+ }
1267
+ for (let i : number = currRowIndex; i < currRowIndex + maxSpan; i++) {
1268
+ rowHeightWithSpan += (isHeader ? this.Grid.headers.getHeader(i).height : this.Grid.rows.getRow(i).height);
1269
+ }
1270
+ // let rowMaxHeight : number = rowHeightWithSpan;
1271
+ // for (let i : number = 0; i < row.cells.count; i++ ) {
1272
+ // rowMaxHeight = rowMaxHeight > row.cells.getCell(i).height ? rowMaxHeight : row.cells.getCell(i).height;
1273
+ // }
1274
+ // let flag : boolean = true;
1275
+ // let nextRow : PdfGridRow = this.Grid.headers.getHeader(this.Grid.headers.indexOf(row) + 1);
1276
+ // for (let i : number = 0; i < nextRow.cells.count; i++ ) {
1277
+ // if (nextRow.cells.getCell(i).value !== '' && nextRow.cells.getCell(i).value !== undefined) {
1278
+ // flag = false;
1279
+ // break;
1280
+ // }
1281
+ // }
1282
+ // if ((rowMaxHeight > rowHeightWithSpan) && flag) {
1283
+ // row.height += (rowMaxHeight - rowHeightWithSpan);
1284
+ // }
1285
+ }
1286
+ let calculatedHeight : number = row.rowBreakHeight > 0.0 ? row.rowBreakHeight : row.height;
1287
+ if (typeof this.Grid.isChildGrid !== 'undefined' && this.Grid.isChildGrid && typeof this.Grid.ParentCell !== 'undefined' && this.Grid.ParentCell != null) {
1288
+ //Split row only if row height exceeds page height and AllowRowBreakAcrossPages is true.
1289
+ // if (calculatedHeight + this.Grid.ParentCell.row.grid.style.cellPadding.bottom +
1290
+ // this.Grid.ParentCell.row.grid.style.cellPadding.top > this.currentPageBounds.height) {
1291
+ // if (this.Grid.allowRowBreakAcrossPages) {
1292
+ // result.isFinish = true;
1293
+ // if ( this.Grid.isChildGrid && row.rowBreakHeight > 0 ) {
1294
+ // if (this.Grid.ParentCell.row.grid.style.cellPadding !== null) {
1295
+ // this.currentBounds.y += this.Grid.ParentCell.row.grid.style.cellPadding.top;
1296
+ // }
1297
+ // this.currentBounds.x = this.startLocation.x;
1298
+ // }
1299
+ // result.bounds = this.currentBounds ;
1300
+ // this.drawRowWithBreak(result, row, calculatedHeight);
1301
+ // } else {
1302
+ // //If AllowRowBreakAcrossPages is not true, draw the row till it fits the page.
1303
+
1304
+ // if (this.Grid.ParentCell.row.grid.style.cellPadding != null) {
1305
+ // this.currentBounds.y += this.Grid.ParentCell.row.grid.style.cellPadding.top;
1306
+ // calculatedHeight = this.currentBounds.height - this.currentBounds.y -
1307
+ // this.Grid.ParentCell.row.grid.style.cellPadding.bottom;
1308
+ // }
1309
+ // result.isFinish = false;
1310
+ // this.drawRow( row, result, calculatedHeight);
1311
+ // }
1312
+ // } else
1313
+ if (this.currentBounds.y + this.Grid.ParentCell.row.grid.style.cellPadding.bottom + calculatedHeight >
1314
+ this.currentPageBounds.height || this.currentBounds.y + this.Grid.ParentCell.row.grid.style.cellPadding.bottom
1315
+ + calculatedHeight > this.currentBounds.height || this.currentBounds.y +
1316
+ this.Grid.ParentCell.row.grid.style.cellPadding.bottom + rowHeightWithSpan > this.currentPageBounds.height) {
1317
+ //If a row is repeated and still cannot fit in page, proceed draw.
1318
+ if (typeof this.Grid.ParentCell.row.grid.LayoutFormat !== 'undefined' && this.Grid.ParentCell.row.grid.LayoutFormat.break === PdfLayoutBreakType.FitPage ) {
1319
+ PdfGridLayouter.repeatRowIndex = this.Grid.rows.rowCollection.indexOf(row);
1320
+ this.Grid.splitChildRowIndex = this.Grid.rows.rowCollection.indexOf(row);
1321
+ }
1322
+ if (PdfGridLayouter.repeatRowIndex > -1 && PdfGridLayouter.repeatRowIndex === row.rowIndex) {
1323
+ if (this.Grid.allowRowBreakAcrossPages) {
1324
+ result.isFinish = true;
1325
+ // if (this.Grid.isChildGrid && row.rowBreakHeightValue > 0) {
1326
+ // // if (this.Grid.ParentCell.row.grid.style.cellPadding != null) {
1327
+ // // this.currentBounds.y += this.Grid.ParentCell.row.grid.style.cellPadding.top;
1328
+ // // }
1329
+ // this.currentBounds.x = this.startLocation.x;
1330
+ // }
1331
+ result.bounds = this.currentBounds;
1332
+ this.drawRowWithBreak(result, row, calculatedHeight);
1333
+ row.repeatFlag = true;
1334
+ row.repeatRowNumber = PdfGridLayouter.repeatRowIndex;
1335
+ }
1336
+ // else {
1337
+ // result.isFinish = false;
1338
+ // row.repeatFlag = false;
1339
+ // this.drawRow( row, result, calculatedHeight);
1340
+ // }
1341
+ }
1342
+ // else {
1343
+ // result.isFinish = false;
1344
+ // }
1345
+ } else {
1346
+ result.isFinish = true;
1347
+ if (row.grid.ParentCell.row.rowBreakHeightValue > 0 ) {
1348
+ row.repeatFlag = true;
1349
+ } else {
1350
+ row.repeatFlag = false;
1351
+ calculatedHeight = row.height;
1352
+ }
1353
+ if (this.Grid.isChildGrid && row.rowBreakHeight > 0) {
1354
+ if (this.Grid.ParentCell.row.grid.style.cellPadding != null) {
1355
+ calculatedHeight += this.Grid.ParentCell.row.grid.style.cellPadding.bottom;
1356
+ }
1357
+ }
1358
+ this.drawRow( row, result, calculatedHeight);
1359
+ }
1360
+ } else {
1361
+ //Split row only if row height exceeds page height and AllowRowBreakAcrossPages is true.
1362
+ if (calculatedHeight > this.currentPageBounds.height) {
1363
+ if (this.Grid.allowRowBreakAcrossPages) {
1364
+ result.isFinish = true;
1365
+ //result.bounds = this.currentBounds;
1366
+ this.drawRowWithBreak(result, row, calculatedHeight);
1367
+ row.isrowFinish = true;
1368
+ row.repeatFlag = true;
1369
+ if (row.grid.splitChildRowIndex !== -1) {
1370
+ result.isFinish = false;
1371
+ }
1372
+ }
1373
+ // else {
1374
+ // //If AllowRowBreakAcrossPages is not true, draw the row till it fits the page.
1375
+ // result.isFinish = false;
1376
+ // this.drawRow( row, result, calculatedHeight);
1377
+ // }
1378
+ } else if (this.currentBounds.y + calculatedHeight > this.currentPageBounds.height ||
1379
+ this.currentBounds.y + calculatedHeight > (this.currentBounds.height + this.startLocation.y) ||
1380
+ this.currentBounds.y + rowHeightWithSpan > this.currentPageBounds.height) {
1381
+ // If a row is repeated and still cannot fit in page, proceed draw.
1382
+ let isFit: boolean = false;
1383
+ if ((this.Grid.allowRowBreakAcrossPages && !this.Grid.repeatHeader && !row.isRowHeightSet && !row.rowMergeComplete)) {
1384
+ if (this.Grid.LayoutFormat !== null && this.Grid.LayoutFormat.paginateBounds.height > 0) {
1385
+ isFit = this.isFitToCell((this.currentBounds.height + this.startLocation.y) - this.currentBounds.y, this.Grid, row);
1386
+ }
1387
+ else
1388
+ isFit = this.isFitToCell(this.currentPageBounds.height - this.currentBounds.y, this.Grid, row);
1389
+ if (isFit) {
1390
+ this.isPaginate = true;
1391
+ }
1392
+ }
1393
+ else if (this.Grid.allowRowBreakAcrossPages && this.Grid.LayoutFormat != null && this.Grid.LayoutFormat.layout == PdfLayoutType.Paginate && this.Grid.LayoutFormat.break != PdfLayoutBreakType.FitElement && row.isRowHeightSet && this.currentBounds.y + height > this.currentPageBounds.height) {
1394
+ isFit = this.isFitToCell(this.currentPageBounds.height - this.currentBounds.y, this.Grid, row);
1395
+ if (!isFit)
1396
+ isFit = !(this.slr !== null && this.slr.actualSize.height == 0 && this.slr.remainder != null && this.slr.remainder.length > 0 && this.remainderText == this.slr.remainder);
1397
+
1398
+ if (isFit && this.slr != null && this.slr.lineCount > 1) {
1399
+ //It may text cutoff issue
1400
+ isFit = false;
1401
+ }
1402
+ this.remainderText = null;
1403
+ }
1404
+ if (PdfGridLayouter.repeatRowIndex > -1 && PdfGridLayouter.repeatRowIndex === row.rowIndex || isFit) {
1405
+ if (this.Grid.allowRowBreakAcrossPages) {
1406
+ result.isFinish = true;
1407
+ this.drawRowWithBreak(result, row, calculatedHeight);
1408
+ row.repeatFlag = true;
1409
+ row.repeatRowNumber = PdfGridLayouter.repeatRowIndex;
1410
+ if (row.grid.splitChildRowIndex !== -1) {
1411
+ result.isFinish = false;
1412
+ }
1413
+ }
1414
+ else {
1415
+ result.isFinish = false;
1416
+ this.drawRow(row, result, calculatedHeight);
1417
+ }
1418
+ } else {
1419
+ result.isFinish = false;
1420
+ }
1421
+ } else {
1422
+ result.isFinish = true;
1423
+ this.drawRow(row, result, calculatedHeight);
1424
+ row.repeatFlag = false;
1425
+ }
1426
+ }
1427
+ return result;
1428
+ } else {
1429
+ let skipcell : boolean = false;
1430
+ let location : PointF = new PointF(this.currentBounds.x, this.currentBounds.y);
1431
+ // if (row.grid.isChildGrid && row.grid.allowRowBreakAcrossPages && this.startLocation.x !== this.currentBounds.x && row.width <
1432
+ // this.currentPage.getClientSize().width) {
1433
+ // location.x = this.startLocation.x;
1434
+ // }
1435
+ result.bounds = new RectangleF(location, new SizeF(0, 0));
1436
+ height = this.ReCalculateHeight(row, height);
1437
+ for (let i : number = this.cellStartIndex; i <= this.cellEndIndex; i++) {
1438
+ let cancelSpans : boolean = ((i > this.cellEndIndex + 1) && (row.cells.getCell(i).columnSpan > 1));
1439
+ // let cancelSpans : boolean = false;
1440
+ if (!cancelSpans) {
1441
+ for (let j : number = 1; j < row.cells.getCell(i).columnSpan; j++) {
1442
+ row.cells.getCell(i + j).isCellMergeContinue = true;
1443
+ }
1444
+ }
1445
+ let size : SizeF = new SizeF(this.Grid.columns.getColumn(i).width, height);
1446
+ // if (size.width > this.currentGraphics.clientSize.width) {
1447
+ // size.width = this.currentGraphics.clientSize.width;
1448
+ // }
1449
+ // if (this.Grid.isChildGrid && this.Grid.style.allowHorizontalOverflow) {
1450
+ // if (size.width >= this.currentGraphics.clientSize.width) {
1451
+ // size.width -= 2 * this.currentBounds.x;
1452
+ // }
1453
+ // }
1454
+ /* tslint:disable */
1455
+ if (!this.CheckIfDefaultFormat(this.Grid.columns.getColumn(i).format) &&
1456
+ this.CheckIfDefaultFormat(row.cells.getCell(i).stringFormat)) {
1457
+ row.cells.getCell(i).stringFormat = this.Grid.columns.getColumn(i).format;
1458
+ }
1459
+ let cellstyle : PdfGridCellStyle = row.cells.getCell(i).style;
1460
+ let tempValue : string = ((typeof row.cells.getCell(i).value === 'string' &&
1461
+ row.cells.getCell(i).value !== null) ? row.cells.getCell(i).value : '') as string;
1462
+
1463
+ row.cells.getCell(i).style = this.RaiseBeforeCellDraw(this.currentGraphics, this.currentRowIndex, i,
1464
+ new RectangleF(location, size), tempValue, cellstyle);
1465
+ //row.cells.getCell(i).style = cellstyle;
1466
+ if (!skipcell) {
1467
+ if (row.cells.getCell(i).value instanceof PdfGrid)
1468
+ {
1469
+ let grid :PdfGrid = row.cells.getCell(i).value as PdfGrid;
1470
+ grid.parentCellIndex = i;
1471
+ }
1472
+ let stringResult : PdfStringLayoutResult = row.cells.getCell(i).draw(this.currentGraphics,
1473
+ new RectangleF(location, size), cancelSpans);
1474
+ if (row.grid.style.allowHorizontalOverflow && (row.cells.getCell(i).columnSpan > this.cellEndIndex ||
1475
+ i + row.cells.getCell(i).columnSpan > this.cellEndIndex + 1) && this.cellEndIndex < row.cells.count - 1) {
1476
+ row.rowOverflowIndex = this.cellEndIndex;
1477
+ }
1478
+ if (row.grid.style.allowHorizontalOverflow && (row.rowOverflowIndex > 0 && (row.cells.getCell(i).columnSpan >
1479
+ this.cellEndIndex || i + row.cells.getCell(i).columnSpan > this.cellEndIndex + 1)) &&
1480
+ row.cells.getCell(i).columnSpan - this.cellEndIndex + i - 1 > 0) {
1481
+ row.cells.getCell(row.rowOverflowIndex + 1).value = stringResult !== null ? (stringResult.remainder !== undefined) ?
1482
+ stringResult.remainder : '' : '';
1483
+ row.cells.getCell(row.rowOverflowIndex + 1).stringFormat = row.cells.getCell(i).stringFormat;
1484
+ row.cells.getCell(row.rowOverflowIndex + 1).style = row.cells.getCell(i).style;
1485
+ row.cells.getCell(row.rowOverflowIndex + 1).columnSpan = row.cells.getCell(i).columnSpan - this.cellEndIndex + i - 1;
1486
+ }
1487
+ }
1488
+ /* tslint:enable */
1489
+ tempValue = ((typeof row.cells.getCell(i).value === 'string' &&
1490
+ row.cells.getCell(i).value !== null) ? row.cells.getCell(i).value : '') as string;
1491
+ if (!cancelSpans) {
1492
+ this.raiseAfterCellDraw(this.currentGraphics, this.currentRowIndex, i,
1493
+ new RectangleF(location, size), tempValue, row.cells.getCell(i).style);
1494
+ }
1495
+ if (row.cells.getCell(i).value instanceof PdfGrid) {
1496
+ let grid : PdfGrid = row.cells.getCell(i).value as PdfGrid;
1497
+ if (this.Grid.columns.getColumn(i).width >= this.currentGraphics.clientSize.width) {
1498
+ location.x = grid.rowLayoutBoundsWidth;
1499
+ location.x += grid.style.cellSpacing;
1500
+ } else {
1501
+ location.x += this.Grid.columns.getColumn(i).width;
1502
+ }
1503
+ } else {
1504
+ location.x += this.Grid.columns.getColumn(i).width;
1505
+ }
1506
+ }
1507
+ if (!row.rowMergeComplete || row.isRowHeightSet) {
1508
+ this.currentBounds.y += height;
1509
+ }
1510
+ result.bounds = new RectangleF(new PointF(result.bounds.x, result.bounds.y), new SizeF(location.x, location.y));
1511
+ }
1512
+ }
1513
+
1514
+ private isFitToCell(currentHeight: number, grid: PdfGrid, gridRow: PdfGridRow): boolean {
1515
+ let isFit: boolean = false;
1516
+ let layouter: PdfStringLayouter = new PdfStringLayouter();
1517
+ for (let i: number = 0; i < gridRow.cells.count; i++) {
1518
+ let cell: PdfGridCell = gridRow.cells.getCell(i);
1519
+ if (typeof cell.value !== 'undefined' && cell.value !== null && typeof cell.value === 'string') {
1520
+ let font: PdfFont = null;
1521
+ if (typeof cell.style.font !== 'undefined' && cell.style.font != null) {
1522
+ font = cell.style.font;
1523
+ } else if (typeof cell.row.style.font !== 'undefined' && cell.row.style.font != null) {
1524
+ font = cell.row.style.font;
1525
+ } else if (typeof cell.row.grid.style.font !== 'undefined' && cell.row.grid.style.font != null) {
1526
+ font = cell.row.grid.style.font;
1527
+ } else {
1528
+ font = PdfDocument.defaultFont;
1529
+ }
1530
+ this.remainderText = gridRow.cells.getCell(i).value as string;
1531
+ let width: number = gridRow.cells.getCell(i).width;
1532
+ if (grid.columns.getColumn(i).isCustomWidth && gridRow.cells.getCell(i).width > grid.columns.getColumn(i).width) {
1533
+ width = grid.columns.getColumn(i).width;
1534
+ }
1535
+ this.slr = layouter.layout(gridRow.cells.getCell(i).value as string, font, gridRow.cells.getCell(i).stringFormat, new SizeF(width, currentHeight), false, this.currentPageBounds);
1536
+ let height: number = this.slr.actualSize.height;
1537
+ if (height == 0) {
1538
+ isFit = false;
1539
+ break;
1540
+ }
1541
+ if (gridRow.cells.getCell(i).style != null && gridRow.cells.getCell(i).style.borders != null && gridRow.cells.getCell(i).style.borders.top != null && gridRow.cells.getCell(i).style.borders.bottom != null)
1542
+ height += (gridRow.cells.getCell(i).style.borders.top.width + gridRow.cells.getCell(i).style.borders.bottom.width) * 2;
1543
+ if (this.slr.lineCount > 1 && gridRow.cells.getCell(i).stringFormat != null && gridRow.cells.getCell(i).stringFormat.lineSpacing != 0)
1544
+ height += (this.slr.lineCount - 1) * (gridRow.cells.getCell(i).style.stringFormat.lineSpacing);
1545
+
1546
+ if (gridRow.cells.getCell(i).style.cellPadding == null) {
1547
+ height += (grid.style.cellPadding.top + grid.style.cellPadding.bottom);
1548
+ }
1549
+ else {
1550
+ height += (grid.style.cellPadding.top + grid.style.cellPadding.bottom);
1551
+ }
1552
+ height += grid.style.cellSpacing;
1553
+ if (currentHeight > height || (typeof this.slr.remainder !== 'undefined' && this.slr.remainder !== null)) {
1554
+ isFit = true;
1555
+ break;
1556
+ }
1557
+ }
1558
+ }
1559
+ return isFit;
1560
+ }
1561
+ /**
1562
+ * `Draws row`
1563
+ * @private
1564
+ */
1565
+ private drawRowWithBreak(result : RowLayoutResult, row : PdfGridRow, calculateHeight : number) : void
1566
+ private drawRowWithBreak(result ?: RowLayoutResult, row ?: PdfGridRow, calculateHeight ?: number) : RowLayoutResult|void {
1567
+ let location : PointF = new PointF(this.currentBounds.x, this.currentBounds.y);
1568
+ if (row.grid.isChildGrid && row.grid.allowRowBreakAcrossPages && this.startLocation.x !== this.currentBounds.x) {
1569
+ location.x = this.startLocation.x;
1570
+ }
1571
+ result.bounds = new RectangleF(location, new SizeF(0, 0));
1572
+ this.gridHeight = row.rowBreakHeight > 0 ? this.currentPageBounds.height : 0;
1573
+ // Calculate the remaining height.
1574
+ if (row.grid.style.cellPadding.top + this.currentBounds.y + row.grid.style.cellPadding.bottom < this.currentPageBounds.height) {
1575
+ row.rowBreakHeight = this.currentBounds.y + calculateHeight - this.currentPageBounds.height;
1576
+ }
1577
+ // else {
1578
+ // row.rowBreakHeight = calculateHeight;
1579
+ // result.isFinish = false;
1580
+ // return;
1581
+ // }
1582
+ // No need to explicit break if the row height is equal to grid height.
1583
+ for (let i : number = 0; i < row.cells.count; i++) {
1584
+ let cell : PdfGridCell = row.cells.getCell(i);
1585
+ let cellHeight : number = cell.measureHeight();
1586
+ if (cellHeight === calculateHeight && cell.value instanceof PdfGrid) {
1587
+ row.rowBreakHeight = 0;
1588
+ }
1589
+ // else if (cellHeight === calculateHeight && (cell.value as PdfGrid) === null) {
1590
+ // row.rowBreakHeight = this.currentBounds.y + calculateHeight - this.currentPageBounds.height;
1591
+ // }
1592
+ }
1593
+ for (let i : number = this.cellStartIndex; i <= this.cellEndIndex; i++) {
1594
+ let cancelSpans : boolean = ((row.cells.getCell(i).columnSpan + i > this.cellEndIndex + 1) &&
1595
+ (row.cells.getCell(i).columnSpan > 1));
1596
+ // if (!cancelSpans) {
1597
+ // for (let k : number = 1; k < row.cells.getCell(i).columnSpan; k++) {
1598
+ // row.cells.getCell(i + k).isCellMergeContinue = true;
1599
+ // }
1600
+ //}
1601
+ let size : SizeF = new SizeF(this.Grid.columns.getColumn(i).width, this.gridHeight > 0.0 ? this.gridHeight :
1602
+ this.currentPageBounds.height);
1603
+ // if (size.width === 0) {
1604
+ // size = new SizeF(row.cells.getCell(i).width, size.height);
1605
+ // }
1606
+ // if (!this.CheckIfDefaultFormat(this.Grid.columns.getColumn(i).format) &&
1607
+ // this.CheckIfDefaultFormat((row.cells.getCell(i).stringFormat))) {
1608
+ // row.cells.getCell(i).stringFormat = this.Grid.columns.getColumn(i).format;
1609
+ // }
1610
+ let cellstyle1 : PdfGridCellStyle = row.cells.getCell(i).style;
1611
+ row.cells.getCell(i).style = cellstyle1;
1612
+ let skipcell : boolean = false;
1613
+ let stringResult : PdfStringLayoutResult = null;
1614
+ if (!skipcell) {
1615
+ stringResult = row.cells.getCell(i).draw(this.currentGraphics, new RectangleF(location, size), cancelSpans);
1616
+ }
1617
+ //If still row is to be drawn, set cell finished drawing cell as false and update the text to be drawn.
1618
+ if (row.rowBreakHeight > 0.0) {
1619
+ if (stringResult != null && typeof stringResult.remainder !== 'undefined') {
1620
+ row.cells.getCell(i).FinishedDrawingCell = false;
1621
+ row.cells.getCell(i).remainingString = stringResult.remainder == null ? ' ' : stringResult.remainder;
1622
+ row.rowBreakHeight = calculateHeight - stringResult.actualSize.height;
1623
+ }
1624
+ }
1625
+ result.isFinish = (!result.isFinish) ? result.isFinish : row.cells.getCell(i).FinishedDrawingCell;
1626
+ // let tempValue : string = ((typeof row.cells.getCell(i).value === 'string' &&
1627
+ //row.cells.getCell(i).value !== null) ? row.cells.getCell(i).value : '') as string;
1628
+ // if (!cancelSpans) {
1629
+ // // this.raiseAfterCellDraw(this.currentGraphics, this.currentRowIndex, i,
1630
+ // // new RectangleF(location, size), tempValue, row.cells.getCell(i).style);
1631
+ // this.raiseAfterCellDraw(this.currentGraphics, this.currentRowIndex, i, new RectangleF(location, size),
1632
+ // (row.cells.getCell(i).value as string) ? row.cells.getCell(i).value.toString() : ' ',
1633
+ // row.cells.getCell(i).style);
1634
+ // }
1635
+ if (row.cells.getCell(i).value instanceof PdfGrid) {
1636
+ let grid : PdfGrid = row.cells.getCell(i).value as PdfGrid;
1637
+ this.rowBreakPageHeightCellIndex = i;
1638
+ // row.cells.getCell(i).pageCount = grid.listOfNavigatePages.length;
1639
+ // for (let j : number = 0;j<grid.listOfNavigatePages.length;j++){
1640
+ // let pageIndex : number =grid.listOfNavigatePages.indexOf(j);
1641
+ // this.Grid.listOfNavigatePages.push(pageIndex);
1642
+ // }
1643
+ if (this.Grid.columns.getColumn(i).width >= this.currentGraphics.clientSize.width) {
1644
+ location.x = this.rowLayoutBoundsWidth;
1645
+ location.x += grid.style.cellSpacing;
1646
+ } else {
1647
+ location.x += this.Grid.columns.getColumn(i).width;
1648
+ }
1649
+ } else {
1650
+ location.x += this.Grid.columns.getColumn(i).width;
1651
+ }
1652
+ }
1653
+ this.currentBounds.y += this.gridHeight > 0.0 ? this.gridHeight : calculateHeight;
1654
+ result.bounds = new RectangleF(new PointF(result.bounds.x, result.bounds.y), new SizeF(location.x, location.y));
1655
+ }
1656
+ }
1657
+ // recalculateBounds : boolean, clientSize : SizeF
1658
+ //Implementation
1659
+ /**
1660
+ * `Initializes` internal data.
1661
+ * @private
1662
+ */
1663
+ //Internal declaration
1664
+ export class PdfGridLayoutResult extends PdfLayoutResult {
1665
+ /**
1666
+ * Constructor
1667
+ * @private
1668
+ */
1669
+ public constructor(page : PdfPage, bounds : RectangleF) {
1670
+ super(page, bounds);
1671
+ }
1672
+ }
1673
+ /**
1674
+ * `PdfGridLayoutFormat` class represents a flexible grid that consists of columns and rows.
1675
+ */
1676
+ export class PdfGridLayoutFormat extends PdfLayoutFormat {
1677
+ // Constructors
1678
+ /**
1679
+ * Initializes a new instance of the `PdfGridLayoutFormat` class.
1680
+ * @private
1681
+ */
1682
+ public constructor()
1683
+ /**
1684
+ * Initializes a new instance of the `PdfGridLayoutFormat` class.
1685
+ * @private
1686
+ */
1687
+ public constructor(baseFormat : PdfLayoutFormat)
1688
+ /**
1689
+ * Initializes a new instance of the `PdfGridLayoutFormat` class.
1690
+ * @private
1691
+ */
1692
+ public constructor(baseFormat ?: PdfLayoutFormat) {
1693
+ super(baseFormat);
1694
+ }
1695
+ }
1696
+ export abstract class GridCellEventArgs {
1697
+ // Fields
1698
+ /**
1699
+ * @hidden
1700
+ * @private
1701
+ */
1702
+ private gridRowIndex : number;
1703
+ /**
1704
+ * @hidden
1705
+ * @private
1706
+ */
1707
+ private gridCellIndex : number;
1708
+ /**
1709
+ * @hidden
1710
+ * @private
1711
+ */
1712
+ private internalValue : string;
1713
+ /**
1714
+ * @hidden
1715
+ * @private
1716
+ */
1717
+ private gridBounds : RectangleF;
1718
+ /**
1719
+ * @hidden
1720
+ * @private
1721
+ */
1722
+ private pdfGraphics : PdfGraphics;
1723
+ // Properties
1724
+ /**
1725
+ * Gets the value of current `row index`.
1726
+ * @private
1727
+ */
1728
+ public get rowIndex() : number {
1729
+ return this.gridRowIndex;
1730
+ }
1731
+ /**
1732
+ * Gets the value of current `cell index`.
1733
+ * @private
1734
+ */
1735
+ public get cellIndex() : number {
1736
+ return this.gridCellIndex;
1737
+ }
1738
+ /**
1739
+ * Gets the actual `value` of current cell.
1740
+ * @private
1741
+ */
1742
+ public get value() : string {
1743
+ return this.internalValue;
1744
+ }
1745
+ /**
1746
+ * Gets the `bounds` of current cell.
1747
+ * @private
1748
+ */
1749
+ public get bounds() : RectangleF {
1750
+ return this.gridBounds;
1751
+ }
1752
+ /**
1753
+ * Gets the instance of `current graphics`.
1754
+ * @private
1755
+ */
1756
+ public get graphics() : PdfGraphics {
1757
+ return this.pdfGraphics;
1758
+ }
1759
+ // Constructors
1760
+ /**
1761
+ * Initialize a new instance for `GridCellEventArgs` class.
1762
+ * @private
1763
+ */
1764
+ public constructor(graphics : PdfGraphics, rowIndex : number, cellIndex : number, bounds : RectangleF, value : string) {
1765
+ this.gridRowIndex = rowIndex;
1766
+ this.gridCellIndex = cellIndex;
1767
+ this.internalValue = value;
1768
+ this.gridBounds = bounds;
1769
+ this.pdfGraphics = graphics;
1770
+ }
1771
+ }
1772
+ export class PdfGridBeginCellDrawEventArgs extends GridCellEventArgs {
1773
+ // Fields
1774
+ /**
1775
+ * @hidden
1776
+ * @private
1777
+ */
1778
+ private bSkip : boolean;
1779
+ /**
1780
+ * @hidden
1781
+ * @private
1782
+ */
1783
+ private cellStyle : PdfGridCellStyle;
1784
+ // Properties
1785
+ /**
1786
+ * Gets or sets a value indicating whether the value of this cell should be `skipped`.
1787
+ * @private
1788
+ */
1789
+ public get skip() : boolean {
1790
+ return this.bSkip;
1791
+ }
1792
+ public set skip(value : boolean) {
1793
+ this.bSkip = value;
1794
+ }
1795
+ /**
1796
+ * Gets or sets a `style` value of the cell.
1797
+ * @private
1798
+ */
1799
+ public get style() : PdfGridCellStyle {
1800
+ return this.cellStyle;
1801
+ }
1802
+ public set style(value : PdfGridCellStyle) {
1803
+ this.cellStyle = value;
1804
+ }
1805
+ // Constructors
1806
+ /**
1807
+ * Initializes a new instance of the `StartCellLayoutEventArgs` class.
1808
+ * @private
1809
+ */
1810
+ public constructor(graphics : PdfGraphics, rowIndex : number, cellIndex : number, bounds : RectangleF,
1811
+ value : string, style : PdfGridCellStyle) {
1812
+ super(graphics, rowIndex, cellIndex, bounds, value);
1813
+ this.style = style;
1814
+ }
1815
+ }
1816
+ export class PdfGridEndCellDrawEventArgs extends GridCellEventArgs {
1817
+ // Field
1818
+ /**
1819
+ * @hidden
1820
+ * @private
1821
+ */
1822
+ private cellStyle : PdfGridCellStyle;
1823
+ // Propertise
1824
+ /**
1825
+ * Get the `PdfGridCellStyle`.
1826
+ * @private
1827
+ */
1828
+ public get style() : PdfGridCellStyle {
1829
+ return this.cellStyle;
1830
+ }
1831
+ // Constructors
1832
+ /**
1833
+ * Initializes a new instance of the `PdfGridEndCellLayoutEventArgs` class.
1834
+ * @private
1835
+ */
1836
+ public constructor(graphics : PdfGraphics, rowIndex : number, cellIndex : number, bounds : RectangleF,
1837
+ value : string, style : PdfGridCellStyle) {
1838
+ super(graphics, rowIndex, cellIndex, bounds, value);
1839
+ this.cellStyle = style;
1840
+ }
1841
+ }
1842
+
1843
+ export class PdfCancelEventArgs {
1844
+ // Fields
1845
+ /**
1846
+ * @hidden
1847
+ * @private
1848
+ */
1849
+ private isCancel : boolean;
1850
+ // Properties
1851
+ /**
1852
+ * Gets and Sets the value of `cancel`.
1853
+ * @private
1854
+ */
1855
+ public get cancel() : boolean {
1856
+ return this.isCancel;
1857
+ }
1858
+ public set cancel(value : boolean) {
1859
+ this.isCancel = value;
1860
+ }
1861
+ }
1862
+ export class BeginPageLayoutEventArgs extends PdfCancelEventArgs {
1863
+ // Fields
1864
+ /**
1865
+ * The `bounds` of the lay outing on the page.
1866
+ * @private
1867
+ */
1868
+ private cellBounds : RectangleF;
1869
+ /**
1870
+ * `Page` where the lay outing should start.
1871
+ * @private
1872
+ */
1873
+ private pdfPage : PdfPage;
1874
+ // Properties
1875
+ /**
1876
+ * Gets or sets value that indicates the lay outing `bounds` on the page.
1877
+ * @private
1878
+ */
1879
+ public get bounds() : RectangleF {
1880
+ return this.cellBounds;
1881
+ }
1882
+ public set bounds(value : RectangleF) {
1883
+ this.cellBounds = value;
1884
+ }
1885
+ /**
1886
+ * Gets the `page` where the lay outing should start.
1887
+ * @private
1888
+ */
1889
+ public get page() : PdfPage {
1890
+ return this.pdfPage;
1891
+ }
1892
+ // Constructors
1893
+ /**
1894
+ * Initializes a new instance of the `BeginPageLayoutEventArgs` class with the specified rectangle and page.
1895
+ * @private
1896
+ */
1897
+ public constructor(bounds : RectangleF, page : PdfPage) {
1898
+ super();
1899
+ this.bounds = bounds;
1900
+ this.pdfPage = page;
1901
+ }
1902
+ }
1903
+ /**
1904
+ * `EndPageLayoutEventArgs` class is alternate for end page layout events.
1905
+ */
1906
+
1907
+ export class EndPageLayoutEventArgs extends PdfCancelEventArgs {
1908
+ // Fields
1909
+ /**
1910
+ * `Layout result`.
1911
+ * @private
1912
+ */
1913
+ private layoutResult : PdfLayoutResult;
1914
+ /**
1915
+ * The `next page` for lay outing.
1916
+ * @private
1917
+ */
1918
+ private nextPdfPage : PdfPage;
1919
+ // Properties
1920
+ /**
1921
+ * Gets the lay outing `result` of the page.
1922
+ * @private
1923
+ */
1924
+ public get result() : PdfLayoutResult {
1925
+ return this.layoutResult;
1926
+ }
1927
+ /**
1928
+ * Gets or sets a value indicating the `next page` where the element should be layout.
1929
+ * @private
1930
+ */
1931
+ public get nextPage() : PdfPage {
1932
+ return this.nextPdfPage;
1933
+ }
1934
+ public set nextPage(value : PdfPage) {
1935
+ this.nextPdfPage = value;
1936
+ }
1937
+ // Constructors
1938
+ /**
1939
+ * Initializes a new instance of the `EndPageLayoutEventArgs` class. with the specified 'PdfLayoutResult'.
1940
+ * @private
1941
+ */
1942
+ public constructor(result : PdfLayoutResult) {
1943
+ super();
1944
+ this.layoutResult = result;
1945
+ }
1946
+ }
1947
+ /**
1948
+ * `PdfGridBeginPageLayoutEventArgs` class is alternate for begin page layout events.
1949
+ */
1950
+ export class PdfGridBeginPageLayoutEventArgs extends BeginPageLayoutEventArgs {
1951
+ // Fields
1952
+ /**
1953
+ * @hidden
1954
+ * @private
1955
+ */
1956
+ private startRow : number;
1957
+ // Properties
1958
+ /**
1959
+ * Gets the `start row index`.
1960
+ * @private
1961
+ */
1962
+ public get startRowIndex() : number {
1963
+ return this.startRow;
1964
+ }
1965
+ // Constructors
1966
+ /**
1967
+ * Initialize a new instance of `PdfGridBeginPageLayoutEventArgs` class.
1968
+ * @private
1969
+ */
1970
+ public constructor(bounds : RectangleF, page : PdfPage, startRow : number) {
1971
+ super(bounds, page);
1972
+ this.startRow = startRow;
1973
+ }
1974
+ }
1975
+ /**
1976
+ * `PdfGridEndPageLayoutEventArgs` class is alternate for begin page layout events.
1977
+ */
1978
+ export class PdfGridEndPageLayoutEventArgs extends EndPageLayoutEventArgs {
1979
+ // Constructors
1980
+ /**
1981
+ * Initialize a new instance of `PdfGridEndPageLayoutEventArgs` class.
1982
+ * @private
1983
+ */
1984
+ public constructor(result : PdfLayoutResult) {
1985
+ super(result);
1986
+ }
1987
+ }
1988
+ export class RowLayoutResult {
1989
+ /**
1990
+ * @hidden
1991
+ * @private
1992
+ */
1993
+ private bIsFinished : boolean;
1994
+ /**
1995
+ * @hidden
1996
+ * @private
1997
+ */
1998
+ private layoutedBounds : RectangleF;
1999
+ /**
2000
+ * Gets or sets a value indicating whether this instance `is finish`.
2001
+ * @private
2002
+ */
2003
+ public get isFinish() : boolean {
2004
+ return this.bIsFinished;
2005
+ }
2006
+ public set isFinish(value : boolean) {
2007
+ this.bIsFinished = value;
2008
+ }
2009
+ /**
2010
+ * Gets or sets the `bounds`.
2011
+ * @private
2012
+ */
2013
+ public get bounds() : RectangleF {
2014
+ return this.layoutedBounds;
2015
+ }
2016
+ public set bounds(value : RectangleF) {
2017
+ this.layoutedBounds = value;
2018
+ }
2019
+ //Constructors
2020
+ /**
2021
+ * Initializes a new instance of the `RowLayoutResult` class.
2022
+ * @private
2023
+ */
2024
+ public constructor() {
2025
+ this.layoutedBounds = new RectangleF(0, 0, 0, 0);
2026
+ }
2027
+ }