// Token: 0x06007CED RID: 31981 RVA: 0x0023255C File Offset: 0x0023075C private static FlowDirection GetTextFlowDirection(ITextPointer pointer) { Invariant.Assert(pointer != null, "Null pointer passed."); Invariant.Assert(pointer.IsAtInsertionPosition, "Pointer is not an insertion position"); int num = 0; LogicalDirection logicalDirection = pointer.LogicalDirection; TextPointerContext pointerContext = pointer.GetPointerContext(logicalDirection); FlowDirection result; if ((pointerContext == TextPointerContext.ElementEnd || pointerContext == TextPointerContext.ElementStart) && !TextSchema.IsFormattingType(pointer.ParentType)) { result = (FlowDirection)pointer.GetValue(FrameworkElement.FlowDirectionProperty); } else { Rect anchorRectangle = TextSelectionHelper.GetAnchorRectangle(pointer); ITextPointer textPointer = pointer.GetNextInsertionPosition(logicalDirection); if (textPointer != null) { textPointer = textPointer.CreatePointer((logicalDirection == LogicalDirection.Backward) ? LogicalDirection.Forward : LogicalDirection.Backward); if (logicalDirection == LogicalDirection.Forward) { if (pointerContext == TextPointerContext.ElementEnd && textPointer.GetPointerContext(textPointer.LogicalDirection) == TextPointerContext.ElementStart) { return((FlowDirection)pointer.GetValue(FrameworkElement.FlowDirectionProperty)); } } else if (pointerContext == TextPointerContext.ElementStart && textPointer.GetPointerContext(textPointer.LogicalDirection) == TextPointerContext.ElementEnd) { return((FlowDirection)pointer.GetValue(FrameworkElement.FlowDirectionProperty)); } Rect anchorRectangle2 = TextSelectionHelper.GetAnchorRectangle(textPointer); if (anchorRectangle2 != Rect.Empty && anchorRectangle != Rect.Empty) { num = Math.Sign(anchorRectangle2.Left - anchorRectangle.Left); if (logicalDirection == LogicalDirection.Backward) { num = -num; } } } if (num == 0) { result = (FlowDirection)pointer.GetValue(FrameworkElement.FlowDirectionProperty); } else { result = ((num > 0) ? FlowDirection.LeftToRight : FlowDirection.RightToLeft); } } return(result); }
// Token: 0x06007CDD RID: 31965 RVA: 0x00231C6C File Offset: 0x0022FE6C private void SetMarkerTransform(Path marker, ITextPointer anchor, ITextPointer baseAnchor, int xScaleFactor) { if (marker == null) { return; } GeometryGroup geometryGroup = marker.Data as GeometryGroup; Rect anchorRectangle = TextSelectionHelper.GetAnchorRectangle(anchor); if (anchorRectangle == Rect.Empty) { return; } double num = anchorRectangle.Height - MarkedHighlightComponent.MarkerVerticalSpace - this._bottomTailHeight - this._topTailHeight; double scaleY = 0.0; double scaleY2 = 0.0; if (num > 0.0) { scaleY = num / this._bodyHeight; scaleY2 = 1.0; } ScaleTransform value = new ScaleTransform(1.0, scaleY); TranslateTransform value2 = new TranslateTransform(anchorRectangle.X, anchorRectangle.Y + this._topTailHeight + MarkedHighlightComponent.MarkerVerticalSpace); TransformGroup transformGroup = new TransformGroup(); transformGroup.Children.Add(value); transformGroup.Children.Add(value2); ScaleTransform value3 = new ScaleTransform((double)xScaleFactor, scaleY2); TranslateTransform value4 = new TranslateTransform(anchorRectangle.X, anchorRectangle.Bottom - this._bottomTailHeight); TranslateTransform value5 = new TranslateTransform(anchorRectangle.X, anchorRectangle.Top + MarkedHighlightComponent.MarkerVerticalSpace); TransformGroup transformGroup2 = new TransformGroup(); transformGroup2.Children.Add(value3); transformGroup2.Children.Add(value4); TransformGroup transformGroup3 = new TransformGroup(); transformGroup3.Children.Add(value3); transformGroup3.Children.Add(value5); if (geometryGroup.Children[0] != null) { geometryGroup.Children[0].Transform = transformGroup3; } if (geometryGroup.Children[1] != null) { geometryGroup.Children[1].Transform = transformGroup; } if (geometryGroup.Children[2] != null) { geometryGroup.Children[2].Transform = transformGroup2; } if (baseAnchor != null) { ITextView documentPageTextView = TextSelectionHelper.GetDocumentPageTextView(baseAnchor); ITextView documentPageTextView2 = TextSelectionHelper.GetDocumentPageTextView(anchor); if (documentPageTextView != documentPageTextView2 && documentPageTextView.RenderScope != null && documentPageTextView2.RenderScope != null) { geometryGroup.Transform = (Transform)documentPageTextView2.RenderScope.TransformToVisual(documentPageTextView.RenderScope); } } }