//-------------------------------------------------------------------- // // Private Methods // //--------------------------------------------------------------------- #region Private methods private void _ProcessImage(DependencyObject obj, FixedNode fixedNode) { Debug.Assert(obj is Image || obj is Path); FixedSOMImage somImage = null; while (true) { Image image = obj as Image; if (image != null) { somImage = FixedSOMImage.Create(_fixedPage, image, fixedNode); break; } Path path = obj as Path; if (path != null) { somImage = FixedSOMImage.Create(_fixedPage, path, fixedNode); break; } } //Create a wrapper FixedBlock: FixedSOMFixedBlock fixedBlock = new FixedSOMFixedBlock(_fixedSOMPage); fixedBlock.AddImage(somImage); _fixedSOMPage.AddFixedBlock(fixedBlock); _currentFixedBlock = fixedBlock; }
// Token: 0x06002DF8 RID: 11768 RVA: 0x000CE9D4 File Offset: 0x000CCBD4 private void _ProcessImage(DependencyObject obj, FixedNode fixedNode) { Image image; Path path; for (;;) { image = (obj as Image); if (image != null) { break; } path = (obj as Path); if (path != null) { goto Block_1; } } FixedSOMImage image2 = FixedSOMImage.Create(this._fixedPage, image, fixedNode); goto IL_34; Block_1: image2 = FixedSOMImage.Create(this._fixedPage, path, fixedNode); IL_34: FixedSOMFixedBlock fixedSOMFixedBlock = new FixedSOMFixedBlock(this._fixedSOMPage); fixedSOMFixedBlock.AddImage(image2); this._fixedSOMPage.AddFixedBlock(fixedSOMFixedBlock); this._currentFixedBlock = fixedSOMFixedBlock; }
//Creates a FixedSOMTextRun, and updates containing structures private void _CreateTextRun(Rect boundingRect, GeneralTransform trans, Glyphs glyphs, FixedNode node, int startIndex, int endIndex) { if (startIndex < endIndex) { FixedSOMTextRun textRun = FixedSOMTextRun.Create(boundingRect, trans, glyphs, node, startIndex, endIndex, true); FixedSOMFixedBlock fixedBlock = _GetContainingFixedBlock(textRun); if (fixedBlock == null) { fixedBlock = new FixedSOMFixedBlock(_fixedSOMPage); fixedBlock.AddTextRun(textRun); _fixedSOMPage.AddFixedBlock(fixedBlock); } else { fixedBlock.AddTextRun(textRun); } _currentFixedBlock = fixedBlock; } }
//Find and return a FixedBlock that would contain this TextRun private FixedSOMFixedBlock _GetContainingFixedBlock(FixedSOMTextRun textRun) { FixedSOMFixedBlock fixedBlock = null; if (_currentFixedBlock == null) { return(null); } if (_currentFixedBlock != null && _IsCombinable(_currentFixedBlock, textRun)) { fixedBlock = _currentFixedBlock; } else { //If this is aligned with the previous block, simply create a new block Rect textRunRect = textRun.BoundingRect; Rect fixedBlockRect = _currentFixedBlock.BoundingRect; if (Math.Abs(textRunRect.Left - fixedBlockRect.Left) <= textRun.DefaultCharWidth || Math.Abs(textRunRect.Right - fixedBlockRect.Right) <= textRun.DefaultCharWidth) { return(null); } foreach (FixedSOMSemanticBox box in _fixedSOMPage.SemanticBoxes) { if ((box is FixedSOMFixedBlock) && _IsCombinable(box as FixedSOMFixedBlock, textRun)) { fixedBlock = box as FixedSOMFixedBlock; } } } return(fixedBlock); }
// Token: 0x06002DFB RID: 11771 RVA: 0x000CED00 File Offset: 0x000CCF00 private FixedSOMFixedBlock _GetContainingFixedBlock(FixedSOMTextRun textRun) { FixedSOMFixedBlock result = null; if (this._currentFixedBlock == null) { return(null); } if (this._currentFixedBlock != null && this._IsCombinable(this._currentFixedBlock, textRun)) { result = this._currentFixedBlock; } else { Rect boundingRect = textRun.BoundingRect; Rect boundingRect2 = this._currentFixedBlock.BoundingRect; if (Math.Abs(boundingRect.Left - boundingRect2.Left) <= textRun.DefaultCharWidth || Math.Abs(boundingRect.Right - boundingRect2.Right) <= textRun.DefaultCharWidth) { return(null); } foreach (FixedSOMSemanticBox fixedSOMSemanticBox in this._fixedSOMPage.SemanticBoxes) { if (fixedSOMSemanticBox is FixedSOMFixedBlock && this._IsCombinable(fixedSOMSemanticBox as FixedSOMFixedBlock, textRun)) { result = (fixedSOMSemanticBox as FixedSOMFixedBlock); } } } return(result); }
//-------------------------------------------------------------------- // // Public methods // //--------------------------------------------------------------------- public void AddContainer(FixedSOMPageElement pageElement) { FixedSOMFixedBlock block = pageElement as FixedSOMFixedBlock; if (block == null || (!block.IsFloatingImage && !block.IsWhiteSpace)) { if (pageElement.IsRTL) { _RTLCount++; } else { _LTRCount++; } } _semanticBoxes.Add(pageElement); if (_boundingRect.IsEmpty) { _boundingRect = pageElement.BoundingRect; } else { _boundingRect.Union(pageElement.BoundingRect); } }
private void _CombinePass() { if (_fixedSOMPage.SemanticBoxes.Count < 2) { //Nothing to do return; } int prevBoxCount; do { prevBoxCount = _fixedSOMPage.SemanticBoxes.Count; List <FixedSOMSemanticBox> boxes = _fixedSOMPage.SemanticBoxes; for (int i = 0; i < boxes.Count; i++) { FixedSOMTable table1 = boxes[i] as FixedSOMTable; if (table1 != null) { //Check for nested tables for (int j = i + 1; j < boxes.Count; j++) { FixedSOMTable table2 = boxes[j] as FixedSOMTable; if (table2 != null && table1.AddContainer(table2)) { boxes.Remove(table2); } } continue; } FixedSOMFixedBlock box1 = boxes[i] as FixedSOMFixedBlock; if (box1 == null || box1.IsFloatingImage) { continue; } for (int j = i + 1; j < boxes.Count; j++) { FixedSOMFixedBlock box2 = boxes[j] as FixedSOMFixedBlock; if (box2 != null && !box2.IsFloatingImage && box2.Matrix.Equals(box1.Matrix) && (_IsSpatiallyCombinable(box1, box2, 0, 0))) { { box1.CombineWith(box2); boxes.Remove(box2); } } } } } while (_fixedSOMPage.SemanticBoxes.Count > 1 && _fixedSOMPage.SemanticBoxes.Count != prevBoxCount); }
// Token: 0x06002DBC RID: 11708 RVA: 0x000CDC50 File Offset: 0x000CBE50 public void CombineWith(FixedSOMFixedBlock block) { foreach (FixedSOMSemanticBox fixedSOMSemanticBox in block.SemanticBoxes) { FixedSOMTextRun fixedSOMTextRun = fixedSOMSemanticBox as FixedSOMTextRun; if (fixedSOMTextRun != null) { this.AddTextRun(fixedSOMTextRun); } else { base.Add(fixedSOMSemanticBox); } } }
public void CombineWith(FixedSOMFixedBlock block) { foreach (FixedSOMSemanticBox box in block.SemanticBoxes) { FixedSOMTextRun run = box as FixedSOMTextRun; if (run != null) { AddTextRun(run); } else { base.Add(box); } } }
// Token: 0x06002E01 RID: 11777 RVA: 0x000CF564 File Offset: 0x000CD764 private void _CombinePass() { if (this._fixedSOMPage.SemanticBoxes.Count < 2) { return; } int count; do { count = this._fixedSOMPage.SemanticBoxes.Count; List <FixedSOMSemanticBox> semanticBoxes = this._fixedSOMPage.SemanticBoxes; for (int i = 0; i < semanticBoxes.Count; i++) { FixedSOMTable fixedSOMTable = semanticBoxes[i] as FixedSOMTable; if (fixedSOMTable != null) { for (int j = i + 1; j < semanticBoxes.Count; j++) { FixedSOMTable fixedSOMTable2 = semanticBoxes[j] as FixedSOMTable; if (fixedSOMTable2 != null && fixedSOMTable.AddContainer(fixedSOMTable2)) { semanticBoxes.Remove(fixedSOMTable2); } } } else { FixedSOMFixedBlock fixedSOMFixedBlock = semanticBoxes[i] as FixedSOMFixedBlock; if (fixedSOMFixedBlock != null && !fixedSOMFixedBlock.IsFloatingImage) { for (int k = i + 1; k < semanticBoxes.Count; k++) { FixedSOMFixedBlock fixedSOMFixedBlock2 = semanticBoxes[k] as FixedSOMFixedBlock; if (fixedSOMFixedBlock2 != null && !fixedSOMFixedBlock2.IsFloatingImage && fixedSOMFixedBlock2.Matrix.Equals(fixedSOMFixedBlock.Matrix) && this._IsSpatiallyCombinable(fixedSOMFixedBlock, fixedSOMFixedBlock2, 0.0, 0.0)) { fixedSOMFixedBlock.CombineWith(fixedSOMFixedBlock2); semanticBoxes.Remove(fixedSOMFixedBlock2); } } } } } }while (this._fixedSOMPage.SemanticBoxes.Count > 1 && this._fixedSOMPage.SemanticBoxes.Count != count); }
public bool AddContainer(FixedSOMContainer container) { Rect bounds = container.BoundingRect; //Allow couple pixels margin double verticalOverlap = bounds.Height * 0.2; double horizontalOverlap = bounds.Width * 0.2; bounds.Inflate(-horizontalOverlap, -verticalOverlap); if (this.BoundingRect.Contains(bounds)) { foreach (FixedSOMTableRow row in this.SemanticBoxes) { if (row.BoundingRect.Contains(bounds)) { foreach (FixedSOMTableCell cell in row.SemanticBoxes) { if (cell.BoundingRect.Contains(bounds)) { cell.AddContainer(container); FixedSOMFixedBlock block = container as FixedSOMFixedBlock; if (block != null) { if (block.IsRTL) { _RTLCount++; } else { _LTRCount++; } } return(true); } } } } } return(false); }
// Token: 0x06002E21 RID: 11809 RVA: 0x000D05D4 File Offset: 0x000CE7D4 public bool AddContainer(FixedSOMContainer container) { Rect boundingRect = container.BoundingRect; double num = boundingRect.Height * 0.2; double num2 = boundingRect.Width * 0.2; boundingRect.Inflate(-num2, -num); if (base.BoundingRect.Contains(boundingRect)) { foreach (FixedSOMSemanticBox fixedSOMSemanticBox in base.SemanticBoxes) { FixedSOMTableRow fixedSOMTableRow = (FixedSOMTableRow)fixedSOMSemanticBox; if (fixedSOMTableRow.BoundingRect.Contains(boundingRect)) { foreach (FixedSOMSemanticBox fixedSOMSemanticBox2 in fixedSOMTableRow.SemanticBoxes) { FixedSOMTableCell fixedSOMTableCell = (FixedSOMTableCell)fixedSOMSemanticBox2; if (fixedSOMTableCell.BoundingRect.Contains(boundingRect)) { fixedSOMTableCell.AddContainer(container); FixedSOMFixedBlock fixedSOMFixedBlock = container as FixedSOMFixedBlock; if (fixedSOMFixedBlock != null) { if (fixedSOMFixedBlock.IsRTL) { this._RTLCount++; } else { this._LTRCount++; } } return(true); } } } } return(false); } return(false); }
// Token: 0x06002DC3 RID: 11715 RVA: 0x000CDE50 File Offset: 0x000CC050 public void AddContainer(FixedSOMPageElement pageElement) { FixedSOMFixedBlock fixedSOMFixedBlock = pageElement as FixedSOMFixedBlock; if (fixedSOMFixedBlock == null || (!fixedSOMFixedBlock.IsFloatingImage && !fixedSOMFixedBlock.IsWhiteSpace)) { if (pageElement.IsRTL) { this._RTLCount++; } else { this._LTRCount++; } } this._semanticBoxes.Add(pageElement); if (this._boundingRect.IsEmpty) { this._boundingRect = pageElement.BoundingRect; return; } this._boundingRect.Union(pageElement.BoundingRect); }
private bool _IsCombinable(FixedSOMFixedBlock fixedBlock, FixedSOMTextRun textRun) { Debug.Assert(fixedBlock.SemanticBoxes.Count > 0); if (fixedBlock.SemanticBoxes.Count == 0) { return(false); } //Currently we do not support inline images if (fixedBlock.IsFloatingImage) { return(false); } Rect textRunRect = textRun.BoundingRect; Rect fixedBlockRect = fixedBlock.BoundingRect; FixedSOMTextRun compareLine = null; FixedSOMTextRun lastLine = fixedBlock.SemanticBoxes[fixedBlock.SemanticBoxes.Count - 1] as FixedSOMTextRun; if (lastLine != null && textRunRect.Bottom <= lastLine.BoundingRect.Top) { //This run is above the last run of the fixed block. Can't be the same paragraph return(false); } bool fixedBlockBelow = false; bool textRunBelow = false; //Allow 20% overlap double verticalOverlap = textRunRect.Height * 0.2; if (textRunRect.Bottom - verticalOverlap < fixedBlockRect.Top) { fixedBlockBelow = true; compareLine = fixedBlock.SemanticBoxes[0] as FixedSOMTextRun; } else if (textRunRect.Top + verticalOverlap > fixedBlockRect.Bottom) { textRunBelow = true; compareLine = fixedBlock.SemanticBoxes[fixedBlock.SemanticBoxes.Count - 1] as FixedSOMTextRun; } if ((fixedBlock.IsWhiteSpace || textRun.IsWhiteSpace) && (fixedBlock != _currentFixedBlock || compareLine != null || !_IsSpatiallyCombinable(fixedBlockRect, textRunRect, textRun.DefaultCharWidth * 3, 0)) ) { //When combining with white spaces, they need to be consecutive in markup and need to be on the same line. return(false); } if (fixedBlock.Matrix.M11 != textRun.Matrix.M11 || fixedBlock.Matrix.M12 != textRun.Matrix.M12 || fixedBlock.Matrix.M21 != textRun.Matrix.M21 || fixedBlock.Matrix.M22 != textRun.Matrix.M22) { //We don't allow combining TextRuns with different scale/rotation properties return(false); } Debug.Assert(textRunRect.Height != 0 && fixedBlock.LineHeight != 0); //Rect textRunRect = textRun.BoundingRect; if (compareLine != null) //Most probably different lines { double ratio = fixedBlock.LineHeight / textRunRect.Height; if (ratio < 1.0) { ratio = 1.0 / ratio; } //Allow 10% height difference if ((ratio > 1.1) && !(FixedTextBuilder.IsSameLine(compareLine.BoundingRect.Top - textRunRect.Top, textRunRect.Height, compareLine.BoundingRect.Height))) { return(false); } } double width = textRun.DefaultCharWidth; if (width < 1.0) { width = 1.0; } double dHorInflate = 0; double heightRatio = fixedBlock.LineHeight / textRunRect.Height; if (heightRatio < 1.0) { heightRatio = 1.0 / heightRatio; } //If consecutive in markup and seem to be on the same line, almost discard horizontal distance if (fixedBlock == _currentFixedBlock && compareLine == null && heightRatio < 1.5 ) { dHorInflate = 200; } else { dHorInflate = width * 1.5; } if (!_IsSpatiallyCombinable(fixedBlockRect, textRunRect, dHorInflate, textRunRect.Height * 0.7)) { return(false); } //If these two have originated from the same Glyphs element, this means we intentionally separated them (separated by vertical lines). //Don't combine in this case. FixedSOMElement element = fixedBlock.SemanticBoxes[fixedBlock.SemanticBoxes.Count - 1] as FixedSOMElement; if (element != null && element.FixedNode.CompareTo(textRun.FixedNode) == 0) { return(false); } //Are these seperated by a line? Check only if they are not considered overlapping if (fixedBlockBelow || textRunBelow) { double bottom = 0.0; double top = 0.0; double margin = textRunRect.Height * 0.2; if (textRunBelow) { top = fixedBlockRect.Bottom - margin; bottom = textRunRect.Top + margin; } else { top = textRunRect.Bottom - margin; bottom = fixedBlockRect.Top + margin; } double left = (fixedBlockRect.Left > textRunRect.Left) ? fixedBlockRect.Left : textRunRect.Left; double right = (fixedBlockRect.Right < textRunRect.Right) ? fixedBlockRect.Right: textRunRect.Right; return(!_lines.IsHorizontallySeparated(left, top, right, bottom)); } else { //These two overlap vertically. Let's check whether there is a vertical separator in between double left = (fixedBlockRect.Right < textRunRect.Right) ? fixedBlockRect.Right: textRunRect.Right; double right = (fixedBlockRect.Left > textRunRect.Left) ? fixedBlockRect.Left: textRunRect.Left; if (left > right) { double temp = left; left = right; right = temp; } return(!_lines.IsVerticallySeparated(left, textRunRect.Top, right, textRunRect.Bottom)); } }
// Token: 0x06002DFC RID: 11772 RVA: 0x000CEDF0 File Offset: 0x000CCFF0 private bool _IsCombinable(FixedSOMFixedBlock fixedBlock, FixedSOMTextRun textRun) { if (fixedBlock.SemanticBoxes.Count == 0) { return(false); } if (fixedBlock.IsFloatingImage) { return(false); } Rect boundingRect = textRun.BoundingRect; Rect boundingRect2 = fixedBlock.BoundingRect; FixedSOMTextRun fixedSOMTextRun = null; FixedSOMTextRun fixedSOMTextRun2 = fixedBlock.SemanticBoxes[fixedBlock.SemanticBoxes.Count - 1] as FixedSOMTextRun; if (fixedSOMTextRun2 != null && boundingRect.Bottom <= fixedSOMTextRun2.BoundingRect.Top) { return(false); } bool flag = false; bool flag2 = false; double num = boundingRect.Height * 0.2; if (boundingRect.Bottom - num < boundingRect2.Top) { flag = true; fixedSOMTextRun = (fixedBlock.SemanticBoxes[0] as FixedSOMTextRun); } else if (boundingRect.Top + num > boundingRect2.Bottom) { flag2 = true; fixedSOMTextRun = (fixedBlock.SemanticBoxes[fixedBlock.SemanticBoxes.Count - 1] as FixedSOMTextRun); } if ((fixedBlock.IsWhiteSpace || textRun.IsWhiteSpace) && (fixedBlock != this._currentFixedBlock || fixedSOMTextRun != null || !this._IsSpatiallyCombinable(boundingRect2, boundingRect, textRun.DefaultCharWidth * 3.0, 0.0))) { return(false); } if (fixedBlock.Matrix.M11 != textRun.Matrix.M11 || fixedBlock.Matrix.M12 != textRun.Matrix.M12 || fixedBlock.Matrix.M21 != textRun.Matrix.M21 || fixedBlock.Matrix.M22 != textRun.Matrix.M22) { return(false); } if (fixedSOMTextRun != null) { double num2 = fixedBlock.LineHeight / boundingRect.Height; if (num2 < 1.0) { num2 = 1.0 / num2; } if (num2 > 1.1 && !FixedTextBuilder.IsSameLine(fixedSOMTextRun.BoundingRect.Top - boundingRect.Top, boundingRect.Height, fixedSOMTextRun.BoundingRect.Height)) { return(false); } } double num3 = textRun.DefaultCharWidth; if (num3 < 1.0) { num3 = 1.0; } double num4 = fixedBlock.LineHeight / boundingRect.Height; if (num4 < 1.0) { num4 = 1.0 / num4; } double inflateH; if (fixedBlock == this._currentFixedBlock && fixedSOMTextRun == null && num4 < 1.5) { inflateH = 200.0; } else { inflateH = num3 * 1.5; } if (!this._IsSpatiallyCombinable(boundingRect2, boundingRect, inflateH, boundingRect.Height * 0.7)) { return(false); } FixedSOMElement fixedSOMElement = fixedBlock.SemanticBoxes[fixedBlock.SemanticBoxes.Count - 1] as FixedSOMElement; if (fixedSOMElement != null && fixedSOMElement.FixedNode.CompareTo(textRun.FixedNode) == 0) { return(false); } if (flag || flag2) { double num5 = boundingRect.Height * 0.2; double top; double bottom; if (flag2) { top = boundingRect2.Bottom - num5; bottom = boundingRect.Top + num5; } else { top = boundingRect.Bottom - num5; bottom = boundingRect2.Top + num5; } double left = (boundingRect2.Left > boundingRect.Left) ? boundingRect2.Left : boundingRect.Left; double right = (boundingRect2.Right < boundingRect.Right) ? boundingRect2.Right : boundingRect.Right; return(!this._lines.IsHorizontallySeparated(left, top, right, bottom)); } double num6 = (boundingRect2.Right < boundingRect.Right) ? boundingRect2.Right : boundingRect.Right; double num7 = (boundingRect2.Left > boundingRect.Left) ? boundingRect2.Left : boundingRect.Left; if (FrameworkAppContextSwitches.OptOutOfFixedDocumentModelConstructionFix) { if (num6 > num7) { double num8 = num6; num6 = num7; num7 = num8; } return(!this._lines.IsVerticallySeparated(num6, boundingRect.Top, num7, boundingRect.Bottom)); } return(num6 >= num7 || !this._lines.IsVerticallySeparated(num6, boundingRect.Top, num7, boundingRect.Bottom)); }
private bool _IsCombinable(FixedSOMFixedBlock fixedBlock, FixedSOMTextRun textRun) { Debug.Assert (fixedBlock.SemanticBoxes.Count > 0); if (fixedBlock.SemanticBoxes.Count == 0) { return false; } //Currently we do not support inline images if (fixedBlock.IsFloatingImage) { return false; } Rect textRunRect = textRun.BoundingRect; Rect fixedBlockRect = fixedBlock.BoundingRect; FixedSOMTextRun compareLine = null; FixedSOMTextRun lastLine = fixedBlock.SemanticBoxes[fixedBlock.SemanticBoxes.Count - 1] as FixedSOMTextRun; if (lastLine != null && textRunRect.Bottom <= lastLine.BoundingRect.Top) { //This run is above the last run of the fixed block. Can't be the same paragraph return false; } bool fixedBlockBelow = false; bool textRunBelow = false; //Allow 20% overlap double verticalOverlap = textRunRect.Height * 0.2; if (textRunRect.Bottom - verticalOverlap < fixedBlockRect.Top) { fixedBlockBelow = true; compareLine = fixedBlock.SemanticBoxes[0] as FixedSOMTextRun; } else if (textRunRect.Top + verticalOverlap > fixedBlockRect.Bottom) { textRunBelow = true; compareLine = fixedBlock.SemanticBoxes[fixedBlock.SemanticBoxes.Count-1] as FixedSOMTextRun; } if ( (fixedBlock.IsWhiteSpace || textRun.IsWhiteSpace) && (fixedBlock != _currentFixedBlock || compareLine != null || !_IsSpatiallyCombinable(fixedBlockRect, textRunRect, textRun.DefaultCharWidth * 3, 0)) ) { //When combining with white spaces, they need to be consecutive in markup and need to be on the same line. return false; } if (fixedBlock.Matrix.M11 != textRun.Matrix.M11 || fixedBlock.Matrix.M12 != textRun.Matrix.M12 || fixedBlock.Matrix.M21 != textRun.Matrix.M21 || fixedBlock.Matrix.M22 != textRun.Matrix.M22) { //We don't allow combining TextRuns with different scale/rotation properties return false; } Debug.Assert(textRunRect.Height != 0 && fixedBlock.LineHeight != 0); //Rect textRunRect = textRun.BoundingRect; if (compareLine != null) //Most probably different lines { double ratio = fixedBlock.LineHeight / textRunRect.Height; if (ratio<1.0) { ratio = 1.0 / ratio; } //Allow 10% height difference if ((ratio > 1.1) && !(FixedTextBuilder.IsSameLine(compareLine.BoundingRect.Top - textRunRect.Top, textRunRect.Height, compareLine.BoundingRect.Height))) { return false; } } double width = textRun.DefaultCharWidth; if (width < 1.0) { width = 1.0; } double dHorInflate = 0; double heightRatio = fixedBlock.LineHeight / textRunRect.Height; if (heightRatio < 1.0) { heightRatio = 1.0 / heightRatio; } //If consecutive in markup and seem to be on the same line, almost discard horizontal distance if (fixedBlock == _currentFixedBlock && compareLine == null && heightRatio < 1.5 ) { dHorInflate = 200; } else { dHorInflate = width*1.5; } if (!_IsSpatiallyCombinable(fixedBlockRect, textRunRect, dHorInflate, textRunRect.Height*0.7)) { return false; } //If these two have originated from the same Glyphs element, this means we intentionally separated them (separated by vertical lines). //Don't combine in this case. FixedSOMElement element = fixedBlock.SemanticBoxes[fixedBlock.SemanticBoxes.Count - 1] as FixedSOMElement; if (element!=null && element.FixedNode.CompareTo(textRun.FixedNode) == 0) { return false; } //Are these seperated by a line? Check only if they are not considered overlapping if (fixedBlockBelow || textRunBelow) { double bottom = 0.0; double top = 0.0; double margin = textRunRect.Height * 0.2; if (textRunBelow) { top = fixedBlockRect.Bottom - margin; bottom = textRunRect.Top + margin; } else { top = textRunRect.Bottom - margin ; bottom = fixedBlockRect.Top + margin; } double left = (fixedBlockRect.Left > textRunRect.Left) ? fixedBlockRect.Left : textRunRect.Left; double right = (fixedBlockRect.Right < textRunRect.Right) ? fixedBlockRect.Right: textRunRect.Right; return (!_lines.IsHorizontallySeparated(left, top, right, bottom)); } else { //These two overlap vertically. Let's check whether there is a vertical separator in between double left = (fixedBlockRect.Right < textRunRect.Right) ? fixedBlockRect.Right: textRunRect.Right; double right =(fixedBlockRect.Left > textRunRect.Left) ? fixedBlockRect.Left: textRunRect.Left; if (left > right) { double temp = left; left = right; right = temp; } return (!_lines.IsVerticallySeparated(left, textRunRect.Top, right, textRunRect.Bottom)); } }
//Creates a FixedSOMTextRun, and updates containing structures private void _CreateTextRun(Rect boundingRect, GeneralTransform trans, Glyphs glyphs, FixedNode node, int startIndex, int endIndex) { if (startIndex < endIndex) { FixedSOMTextRun textRun = FixedSOMTextRun.Create(boundingRect, trans, glyphs, node, startIndex, endIndex, true); FixedSOMFixedBlock fixedBlock = _GetContainingFixedBlock(textRun); if (fixedBlock == null) { fixedBlock= new FixedSOMFixedBlock(_fixedSOMPage); fixedBlock.AddTextRun(textRun); _fixedSOMPage.AddFixedBlock(fixedBlock); } else { fixedBlock.AddTextRun(textRun); } _currentFixedBlock = fixedBlock; } }
public void AddFixedBlock(FixedSOMFixedBlock fixedBlock) { base.Add(fixedBlock); }
// Token: 0x06002DDE RID: 11742 RVA: 0x000CE42C File Offset: 0x000CC62C public void AddFixedBlock(FixedSOMFixedBlock fixedBlock) { base.Add(fixedBlock); }