예제 #1
0
 // Token: 0x06002DE0 RID: 11744 RVA: 0x000CE435 File Offset: 0x000CC635
 public override void SetRTFProperties(FixedElement element)
 {
     if (this._cultureInfo != null)
     {
         element.SetValue(FrameworkContentElement.LanguageProperty, XmlLanguage.GetLanguage(this._cultureInfo.IetfLanguageTag));
     }
 }
 // Token: 0x06002D1D RID: 11549 RVA: 0x000CBA20 File Offset: 0x000C9C20
 internal void Append(FixedElement e)
 {
     if (this._type == FixedElement.ElementType.InlineUIContainer)
     {
         this._object = e._object;
     }
 }
예제 #3
0
 // Token: 0x06002E22 RID: 11810 RVA: 0x000D0728 File Offset: 0x000CE928
 public override void SetRTFProperties(FixedElement element)
 {
     if (element.Type == typeof(Table))
     {
         element.SetValue(Table.CellSpacingProperty, 0.0);
     }
 }
예제 #4
0
        /// <summary>
        /// <see cref="ITextPointer.MoveToElementEdge"/>
        /// </summary>
        void ITextPointer.MoveToElementEdge(ElementEdge edge)
        {
            ValidationHelper.VerifyElementEdge(edge, "edge");
            Debug.Assert(!_isFrozen, "Can't reposition a frozen pointer!");

            FixedElement e = _flowPosition.GetScopingElement();

            if (!e.IsTextElement)
            {
                throw new InvalidOperationException(SR.Get(SRID.NoElementObject));
            }

            switch (edge)
            {
            case ElementEdge.BeforeStart:
                _flowPosition = (FlowPosition)e.Start.FlowPosition.Clone();
                _flowPosition.Move(-1);
                break;

            case ElementEdge.AfterStart:
                _flowPosition = (FlowPosition)e.Start.FlowPosition.Clone();
                break;

            case ElementEdge.BeforeEnd:
                _flowPosition = (FlowPosition)e.End.FlowPosition.Clone();
                break;

            case ElementEdge.AfterEnd:
                _flowPosition = (FlowPosition)e.End.FlowPosition.Clone();
                _flowPosition.Move(1);
                break;
            }
        }
        public override void SetRTFProperties(FixedElement element)
        {
            if (_cultureInfo != null)
            {
                element.SetValue(FrameworkElement.LanguageProperty, XmlLanguage.GetLanguage(_cultureInfo.IetfLanguageTag));
            }
            element.SetValue(TextElement.FontSizeProperty, _fontSize);
            element.SetValue(TextElement.FontWeightProperty, _fontWeight);
            element.SetValue(TextElement.FontStretchProperty, _fontStretch);
            element.SetValue(TextElement.FontStyleProperty, _fontStyle);
            if (this.IsRTL)
            {
                element.SetValue(FrameworkElement.FlowDirectionProperty, FlowDirection.RightToLeft);
            }
            else
            {
                element.SetValue(FrameworkElement.FlowDirectionProperty, FlowDirection.LeftToRight);
            }

            if (_fontFamily != null)
            {
                element.SetValue(TextElement.FontFamilyProperty, new FontFamily(_fontFamily));
            }
            element.SetValue(TextElement.ForegroundProperty, _foreground);
        }
예제 #6
0
        internal int GetPageNumber(ITextPointer textPointer)
        {
            FixedTextPointer fixedTextPointer = textPointer as FixedTextPointer;
            int pageNumber = int.MaxValue;

            if (fixedTextPointer != null)
            {
                if (fixedTextPointer.CompareTo(((ITextContainer)this).Start) == 0)
                {
                    pageNumber = 0;
                }
                else if (fixedTextPointer.CompareTo(((ITextContainer)this).End) == 0)
                {
                    pageNumber = this.FixedDocument.PageCount - 1;
                }
                else
                {
                    FlowNode flowNode;
                    int      flowOffset;

                    fixedTextPointer.FlowPosition.GetFlowNode(fixedTextPointer.LogicalDirection, out flowNode, out flowOffset);

                    FixedElement fixedElement = flowNode.Cookie as FixedElement;

                    if (flowNode.Type == FlowNodeType.Boundary)
                    {
                        if (flowNode.Fp > 0)
                        {
                            //Document end boundary node
                            pageNumber = this.FixedDocument.PageCount - 1;
                        }
                        else
                        {
                            //Document start boundary node
                            pageNumber = 0;
                        }
                    }
                    else if (flowNode.Type == FlowNodeType.Virtual || flowNode.Type == FlowNodeType.Noop)
                    {
                        pageNumber = (int)flowNode.Cookie;
                    }
                    else if (fixedElement != null)
                    {
                        pageNumber = (int)fixedElement.PageIndex;
                    }
                    else
                    {
                        FixedPosition fixPos;
                        bool          res = FixedTextBuilder.GetFixedPosition(fixedTextPointer.FlowPosition, fixedTextPointer.LogicalDirection, out fixPos);
                        Debug.Assert(res);
                        if (res)
                        {
                            pageNumber = fixPos.Page;
                        }
                    }
                }
            }

            return(pageNumber);
        }
예제 #7
0
 public override void SetRTFProperties(FixedElement element)
 {
     if (this.IsRTL)
     {
         element.SetValue(FrameworkElement.FlowDirectionProperty, FlowDirection.RightToLeft);
     }
 }
        // Token: 0x06002EB5 RID: 11957 RVA: 0x000D3098 File Offset: 0x000D1298
        bool ITextPointer.HasEqualScope(ITextPointer position)
        {
            FixedTextPointer fixedTextPointer = this.FixedTextContainer.VerifyPosition(position);
            FixedElement     scopingElement   = this._flowPosition.GetScopingElement();
            FixedElement     scopingElement2  = fixedTextPointer.FlowPosition.GetScopingElement();

            return(scopingElement == scopingElement2);
        }
        // Token: 0x06002EB6 RID: 11958 RVA: 0x000D30D0 File Offset: 0x000D12D0
        object ITextPointer.GetValue(DependencyProperty property)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }
            FixedElement scopingElement = this._flowPosition.GetScopingElement();

            return(scopingElement.GetValue(property));
        }
        // Token: 0x06002EB8 RID: 11960 RVA: 0x000D3148 File Offset: 0x000D1348
        LocalValueEnumerator ITextPointer.GetLocalValueEnumerator()
        {
            FixedElement scopingElement = this._flowPosition.GetScopingElement();

            if (!scopingElement.IsTextElement)
            {
                return(new DependencyObject().GetLocalValueEnumerator());
            }
            return(scopingElement.GetLocalValueEnumerator());
        }
예제 #11
0
        /// <summary>
        /// <see cref="ITextPointer.HasEqualScope"/>
        /// </summary>
        bool ITextPointer.HasEqualScope(ITextPointer position)
        {
            FixedTextPointer ftp = this.FixedTextContainer.VerifyPosition(position);

            FixedElement thisFE = _flowPosition.GetScopingElement();
            FixedElement thatFE = ftp.FlowPosition.GetScopingElement();

            // We retun true even if both scoping elements are the
            // container element.
            return(thisFE == thatFE);
        }
        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Public Events
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        // Method to allow append of element
        // Note element order doesn't imply Z-order in this implementation!
        internal void Append(FixedElement e)
        {
#if DEBUG
            _children.Add(e);
#endif
            if (_type == ElementType.InlineUIContainer)
            {
                Debug.Assert(_object == null && e._type == ElementType.Object);
                _object = e._object; // To generate InlineUIContainer with child with object;
            }
        }
예제 #13
0
        /// <summary>
        /// <see cref="ITextPointer.GetLocalValueEnumerator"/>
        /// </summary>
        /// <remarks>Returns an empty enumerator if there is no scoping element</remarks>
        LocalValueEnumerator ITextPointer.GetLocalValueEnumerator()
        {
            FixedElement e = _flowPosition.GetScopingElement();

            if (!e.IsTextElement)
            {
                return((new DependencyObject()).GetLocalValueEnumerator());
            }

            return(e.GetLocalValueEnumerator());
        }
예제 #14
0
        // Token: 0x06002EA0 RID: 11936 RVA: 0x000D2AD4 File Offset: 0x000D0CD4
        internal int GetPageNumber(ITextPointer textPointer)
        {
            FixedTextPointer fixedTextPointer = textPointer as FixedTextPointer;
            int result = int.MaxValue;

            if (fixedTextPointer != null)
            {
                if (fixedTextPointer.CompareTo(((ITextContainer)this).Start) == 0)
                {
                    result = 0;
                }
                else if (fixedTextPointer.CompareTo(((ITextContainer)this).End) == 0)
                {
                    result = this.FixedDocument.PageCount - 1;
                }
                else
                {
                    FlowNode flowNode;
                    int      num;
                    fixedTextPointer.FlowPosition.GetFlowNode(fixedTextPointer.LogicalDirection, out flowNode, out num);
                    FixedElement fixedElement = flowNode.Cookie as FixedElement;
                    if (flowNode.Type == FlowNodeType.Boundary)
                    {
                        if (flowNode.Fp > 0)
                        {
                            result = this.FixedDocument.PageCount - 1;
                        }
                        else
                        {
                            result = 0;
                        }
                    }
                    else if (flowNode.Type == FlowNodeType.Virtual || flowNode.Type == FlowNodeType.Noop)
                    {
                        result = (int)flowNode.Cookie;
                    }
                    else if (fixedElement != null)
                    {
                        result = fixedElement.PageIndex;
                    }
                    else
                    {
                        FixedPosition fixedPosition2;
                        bool          fixedPosition = this.FixedTextBuilder.GetFixedPosition(fixedTextPointer.FlowPosition, fixedTextPointer.LogicalDirection, out fixedPosition2);
                        if (fixedPosition)
                        {
                            result = fixedPosition2.Page;
                        }
                    }
                }
            }
            return(result);
        }
예제 #15
0
        //--------------------------------------------------------------------
        //
        // Private Methods
        //
        //---------------------------------------------------------------------

        #region Private Methods

        //--------------------------------------------------------------------
        // Initilization
        //---------------------------------------------------------------------
        private void _CreateEmptyContainer()
        {
            // new text builder with map
            _fixedTextBuilder = new FixedTextBuilder(this);

            // create initial TextPointer and container element
            _start = new  FixedTextPointer(false, LogicalDirection.Backward, new FlowPosition(this, this.FixedTextBuilder.FixedFlowMap.FlowStartEdge, 1));
            _end   = new FixedTextPointer(false, LogicalDirection.Forward, new FlowPosition(this, this.FixedTextBuilder.FixedFlowMap.FlowEndEdge, 0));

            _containerElement = new FixedElement(FixedElement.ElementType.Container, _start, _end, int.MaxValue);
            _start.FlowPosition.AttachElement(_containerElement);
            _end.FlowPosition.AttachElement(_containerElement);
        }
예제 #16
0
        // Token: 0x06002EA8 RID: 11944 RVA: 0x000D2E3C File Offset: 0x000D103C
        internal void OnNewFlowElement(FixedElement parentElement, FixedElement.ElementType elementType, FlowPosition pStart, FlowPosition pEnd, object source, int pageIndex)
        {
            FixedTextPointer start        = new FixedTextPointer(false, LogicalDirection.Backward, pStart);
            FixedTextPointer end          = new FixedTextPointer(false, LogicalDirection.Forward, pEnd);
            FixedElement     fixedElement = new FixedElement(elementType, start, end, pageIndex);

            if (source != null)
            {
                fixedElement.Object = source;
            }
            parentElement.Append(fixedElement);
            pStart.AttachElement(fixedElement);
            pEnd.AttachElement(fixedElement);
        }
예제 #17
0
        /// <summary>
        /// <see cref="ITextPointer.GetElementType"/>
        /// </summary>
        /// <remarks>Return null if no TextElement in the direction</remarks>
        Type ITextPointer.GetElementType(LogicalDirection direction)
        {
            ValidationHelper.VerifyDirection(direction, "direction");

            TextPointerContext tt = _flowPosition.GetPointerContext(direction);

            if (tt == TextPointerContext.ElementStart || tt == TextPointerContext.ElementEnd)
            {
                FixedElement e = _flowPosition.GetElement(direction);
                return(e.IsTextElement ? e.Type : null);
            }

            return(null);
        }
        // Token: 0x06002EB7 RID: 11959 RVA: 0x000D3100 File Offset: 0x000D1300
        object ITextPointer.ReadLocalValue(DependencyProperty property)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }
            FixedElement scopingElement = this._flowPosition.GetScopingElement();

            if (!scopingElement.IsTextElement)
            {
                throw new InvalidOperationException(SR.Get("NoElementObject"));
            }
            return(scopingElement.ReadLocalValue(property));
        }
예제 #19
0
        internal void OnNewFlowElement(FixedElement parentElement, FixedElement.ElementType elementType, FlowPosition pStart, FlowPosition pEnd, Object source, int pageIndex)
        {
            FixedTextPointer eStart = new FixedTextPointer(false, LogicalDirection.Backward, pStart);
            FixedTextPointer eEnd   = new FixedTextPointer(false, LogicalDirection.Forward, pEnd);
            FixedElement     e      = new FixedElement(elementType, eStart, eEnd, pageIndex);

            if (source != null)
            {
                e.Object = source;
            }
            // hook up logical tree
            parentElement.Append(e);

            // attach element to flownode for faster lookup later.
            pStart.AttachElement(e);
            pEnd.AttachElement(e);
        }
        // Token: 0x06002EB4 RID: 11956 RVA: 0x000D304C File Offset: 0x000D124C
        Type ITextPointer.GetElementType(LogicalDirection direction)
        {
            ValidationHelper.VerifyDirection(direction, "direction");
            TextPointerContext pointerContext = this._flowPosition.GetPointerContext(direction);

            if (pointerContext != TextPointerContext.ElementStart && pointerContext != TextPointerContext.ElementEnd)
            {
                return(null);
            }
            FixedElement element = this._flowPosition.GetElement(direction);

            if (!element.IsTextElement)
            {
                return(null);
            }
            return(element.Type);
        }
예제 #21
0
파일: FlowNode.cs 프로젝트: beda2280/wpf-1
        /// <summary>
        /// Create a string representation of this object
        /// </summary>
        /// <returns>string - A string representation of this object</returns>
        public override string ToString()
        {
            int page = -1;

            switch (_type)
            {
            case FlowNodeType.Boundary:
            case FlowNodeType.Start:
            case FlowNodeType.End:
            case FlowNodeType.Object:
            {
                FixedElement element = _cookie as FixedElement;
                if (element != null)
                {
                    page = element.PageIndex;
                }
                break;
            }

            case FlowNodeType.Virtual:
            case FlowNodeType.Noop:
            {
                page = (int)_cookie;
                break;
            }

            case FlowNodeType.Run:
            {
                if (this.FixedSOMElements != null && this.FixedSOMElements.Length > 0)
                {
                    page = this.FixedSOMElements[0].FixedNode.Page;
                }
                break;
            }

            default:
                break;
            }


            return(String.Format("Pg{0}-nCp{1}-Id{2}-Tp{3}", page, _fp, _scopeId, System.Enum.GetName(typeof(FlowNodeType), _type)));
        }
        // Token: 0x06002EC8 RID: 11976 RVA: 0x000D3320 File Offset: 0x000D1520
        void ITextPointer.MoveToElementEdge(ElementEdge edge)
        {
            ValidationHelper.VerifyElementEdge(edge, "edge");
            FixedElement scopingElement = this._flowPosition.GetScopingElement();

            if (!scopingElement.IsTextElement)
            {
                throw new InvalidOperationException(SR.Get("NoElementObject"));
            }
            switch (edge)
            {
            case ElementEdge.BeforeStart:
                this._flowPosition = (FlowPosition)scopingElement.Start.FlowPosition.Clone();
                this._flowPosition.Move(-1);
                return;

            case ElementEdge.AfterStart:
                this._flowPosition = (FlowPosition)scopingElement.Start.FlowPosition.Clone();
                return;

            case ElementEdge.BeforeStart | ElementEdge.AfterStart:
                break;

            case ElementEdge.BeforeEnd:
                this._flowPosition = (FlowPosition)scopingElement.End.FlowPosition.Clone();
                return;

            default:
                if (edge != ElementEdge.AfterEnd)
                {
                    return;
                }
                this._flowPosition = (FlowPosition)scopingElement.End.FlowPosition.Clone();
                this._flowPosition.Move(1);
                break;
            }
        }
예제 #23
0
        internal void OnNewFlowElement(FixedElement parentElement, FixedElement.ElementType elementType, FlowPosition pStart, FlowPosition pEnd, Object source, int pageIndex)
        {
            FixedTextPointer eStart = new FixedTextPointer(false, LogicalDirection.Backward, pStart);
            FixedTextPointer eEnd = new FixedTextPointer(false, LogicalDirection.Forward, pEnd);
            FixedElement e = new FixedElement(elementType, eStart, eEnd, pageIndex);
            if (source != null)
            {
                e.Object = source;
            }
            // hook up logical tree
            parentElement.Append(e);

            // attach element to flownode for faster lookup later.
            pStart.AttachElement(e);
            pEnd.AttachElement(e);
        }
예제 #24
0
        //--------------------------------------------------------------------
        //
        // Private Methods
        //
        //---------------------------------------------------------------------

        #region Private Methods

        //--------------------------------------------------------------------
        // Initilization
        //---------------------------------------------------------------------
        private void _CreateEmptyContainer()
        {
            // new text builder with map
            _fixedTextBuilder = new FixedTextBuilder(this);

            // create initial TextPointer and container element
            _start = new  FixedTextPointer(false, LogicalDirection.Backward, new FlowPosition(this, this.FixedTextBuilder.FixedFlowMap.FlowStartEdge, 1));
            _end = new FixedTextPointer(false, LogicalDirection.Forward, new FlowPosition(this, this.FixedTextBuilder.FixedFlowMap.FlowEndEdge, 0));

            _containerElement = new FixedElement(FixedElement.ElementType.Container, _start, _end, int.MaxValue);
            _start.FlowPosition.AttachElement(_containerElement);
            _end.FlowPosition.AttachElement(_containerElement);

        }
예제 #25
0
        public override void SetRTFProperties(FixedElement element)
        {
            if (_cultureInfo != null)
            {
                element.SetValue(FrameworkElement.LanguageProperty, XmlLanguage.GetLanguage(_cultureInfo.IetfLanguageTag));
            }
            element.SetValue(TextElement.FontSizeProperty, _fontSize);
            element.SetValue(TextElement.FontWeightProperty, _fontWeight);
            element.SetValue(TextElement.FontStretchProperty, _fontStretch);
            element.SetValue(TextElement.FontStyleProperty, _fontStyle);
            if (this.IsRTL)
            {
                element.SetValue(FrameworkElement.FlowDirectionProperty, FlowDirection.RightToLeft);
            }
            else
            {
                element.SetValue(FrameworkElement.FlowDirectionProperty, FlowDirection.LeftToRight);
            }

            if (_fontFamily != null)
            {
                element.SetValue(TextElement.FontFamilyProperty, new FontFamily(_fontFamily));
            }
            element.SetValue(TextElement.ForegroundProperty, _foreground);
        }
예제 #26
0
        //------------------------------------------------------
        // 
        //  Public Properties
        // 
        //------------------------------------------------------ 

        //----------------------------------------------------- 
        //
        //  Public Events
        //
        //------------------------------------------------------ 

        //----------------------------------------------------- 
        // 
        //  Internal Methods
        // 
        //-----------------------------------------------------

        #region Internal Methods
 
        // Method to allow append of element
        // Note element order doesn't imply Z-order in this implementation! 
        internal void Append(FixedElement e) 
        {
#if DEBUG 
            _children.Add(e);
#endif
            if (_type == ElementType.InlineUIContainer)
            { 
                Debug.Assert(_object == null && e._type == ElementType.Object);
                _object = e._object; // To generate InlineUIContainer with child with object; 
            } 
        }
예제 #27
0
 public override void SetRTFProperties(FixedElement element)
 { 
     if (_cultureInfo != null) 
     {
         element.SetValue(FrameworkContentElement.LanguageProperty, XmlLanguage.GetLanguage(_cultureInfo.IetfLanguageTag)); 
     }
 }
예제 #28
0
 internal void AttachElement(FixedElement fixedElement)
 {
     _cookie = fixedElement;
 }
예제 #29
0
 public override void SetRTFProperties(FixedElement element)
 {
     element.SetValue(Block.BorderThicknessProperty, new Thickness(1));
     element.SetValue(Block.BorderBrushProperty, Brushes.Black);
     element.SetValue(TableCell.ColumnSpanProperty, _columnSpan);
 }
예제 #30
0
 public override void SetRTFProperties(FixedElement element)
 {
     element.SetValue(Block.BorderThicknessProperty, new Thickness(1));
     element.SetValue(Block.BorderBrushProperty, Brushes.Black);
     element.SetValue(TableCell.ColumnSpanProperty, _columnSpan);
 }
 // Token: 0x06002F8C RID: 12172 RVA: 0x000D6310 File Offset: 0x000D4510
 internal void AttachElement(FixedElement fixedElement)
 {
     this._cookie = fixedElement;
 }
예제 #32
0
 public virtual void SetRTFProperties(FixedElement element)
 {
 }
예제 #33
0
 public override void SetRTFProperties(FixedElement element)
 {
     if (element.Type == typeof(Table))
     {
         element.SetValue(Table.CellSpacingProperty, 0.0);
     }
 }
예제 #34
0
 //--------------------------------------------------------------------
 // Internal Methods
 //---------------------------------------------------------------------- 
 internal void AttachElement(FixedElement e)
 { 
     _flowNode.AttachElement(e); 
 }
예제 #35
0
 public virtual void SetRTFProperties(FixedElement element)
 { 
 }
예제 #36
0
 public override void SetRTFProperties(FixedElement element) 
 { 
     if (this.IsRTL)
     { 
         element.SetValue(FrameworkElement.FlowDirectionProperty, FlowDirection.RightToLeft);
     }
 }
예제 #37
0
 //--------------------------------------------------------------------
 // Internal Methods
 //---------------------------------------------------------------------
 internal void AttachElement(FixedElement e)
 {
     _flowNode.AttachElement(e);
 }