//-------------------------------------------------------------------- // // 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; }
// Get Embedeed Object instance internal object GetAdjacentElement(LogicalDirection dir) { FlowPosition flow = GetClingPosition(dir); FlowNodeType type = flow._flowNode.Type; Debug.Assert(type == FlowNodeType.Object || type == FlowNodeType.Noop || type == FlowNodeType.Start || type == FlowNodeType.End); if (type == FlowNodeType.Noop) { return(String.Empty); } else { Object obj = ((FixedElement)flow._flowNode.Cookie).GetObject(); Image image = obj as Image; if (type == FlowNodeType.Object && image != null) { //Set width and height properties by looking at corresponding SOMImage FixedSOMElement[] elements = flow._flowNode.FixedSOMElements; if (elements != null && elements.Length > 0) { FixedSOMImage somImage = elements[0] as FixedSOMImage; if (somImage != null) { image.Width = somImage.BoundingRect.Width; image.Height = somImage.BoundingRect.Height; } } } return(obj); } }
//-------------------------------------------------------------------- // // Public Properties // //--------------------------------------------------------------------- #region Static methods public static FixedSOMElement CreateFixedSOMElement(FixedPage page, UIElement uiElement, FixedNode fixedNode, int startIndex, int endIndex) { FixedSOMElement element = null; if (uiElement is Glyphs) { Glyphs glyphs = uiElement as Glyphs; if (glyphs.UnicodeString.Length > 0) { GlyphRun glyphRun = glyphs.ToGlyphRun(); Rect alignmentBox = glyphRun.ComputeAlignmentBox(); alignmentBox.Offset(glyphs.OriginX, glyphs.OriginY); GeneralTransform transform = glyphs.TransformToAncestor(page); if (startIndex < 0) { startIndex = 0; } if (endIndex < 0) { endIndex = glyphRun.Characters == null ? 0 : glyphRun.Characters.Count; } element = FixedSOMTextRun.Create(alignmentBox, transform, glyphs, fixedNode, startIndex, endIndex, false); } } else if (uiElement is Image) { element = FixedSOMImage.Create(page, uiElement as Image, fixedNode); } else if (uiElement is Path) { element = FixedSOMImage.Create(page, uiElement as Path, fixedNode); } return(element); }
// 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; }
// Token: 0x06002F95 RID: 12181 RVA: 0x000D652C File Offset: 0x000D472C internal object GetAdjacentElement(LogicalDirection dir) { FlowPosition clingPosition = this.GetClingPosition(dir); FlowNodeType type = clingPosition._flowNode.Type; if (type == FlowNodeType.Noop) { return(string.Empty); } object @object = ((FixedElement)clingPosition._flowNode.Cookie).GetObject(); Image image = @object as Image; if (type == FlowNodeType.Object && image != null) { FixedSOMElement[] fixedSOMElements = clingPosition._flowNode.FixedSOMElements; if (fixedSOMElements != null && fixedSOMElements.Length != 0) { FixedSOMImage fixedSOMImage = fixedSOMElements[0] as FixedSOMImage; if (fixedSOMImage != null) { image.Width = fixedSOMImage.BoundingRect.Width; image.Height = fixedSOMImage.BoundingRect.Height; } } } return(@object); }
public void AddImage(FixedSOMImage image) { _AddElement(image); }