Exemplo n.º 1
0
        private void OnLeftMouseDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;

            FixedDocumentPage dp = GetFixedPanelDocumentPage(e.GetPosition(_scope));

            if (dp != null)
            {
                //give focus to the UI Scope so that actions like
                //Copy will work after making a selection.
                _uiScope.Focus();

                //turn on mouse capture
                _scope.CaptureMouse();

                ClearSelection();

                //mark start position
                _panel       = dp.Owner;
                _page        = dp.FixedPage;
                _isSelecting = true;
                _origin      = e.GetPosition(_page);
                _pageIndex   = dp.PageIndex;
            }
        }
        // Token: 0x06002CC2 RID: 11458 RVA: 0x000C9E44 File Offset: 0x000C8044
        internal ContentPosition GetPagePosition(DocumentPage page)
        {
            FixedDocumentPage fixedDocumentPage = page as FixedDocumentPage;

            if (fixedDocumentPage == null)
            {
                return(ContentPosition.Missing);
            }
            return(fixedDocumentPage.ContentPosition);
        }
        // Token: 0x06002CDF RID: 11487 RVA: 0x000CA4C8 File Offset: 0x000C86C8
        internal FixedPage GetFixedPage(int pageNumber)
        {
            FixedPage         result            = null;
            FixedDocumentPage fixedDocumentPage = this.GetPage(pageNumber) as FixedDocumentPage;

            if (fixedDocumentPage != null && fixedDocumentPage != DocumentPage.Missing)
            {
                result = fixedDocumentPage.FixedPage;
            }
            return(result);
        }
Exemplo n.º 4
0
        // Token: 0x06003512 RID: 13586 RVA: 0x000F0994 File Offset: 0x000EEB94
        private void OnLeftMouseDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;
            FixedDocumentPage fixedPanelDocumentPage = this.GetFixedPanelDocumentPage(e.GetPosition(this._scope));

            if (fixedPanelDocumentPage != null)
            {
                this._uiScope.Focus();
                this._scope.CaptureMouse();
                this.ClearSelection();
                this._panel       = fixedPanelDocumentPage.Owner;
                this._page        = fixedPanelDocumentPage.FixedPage;
                this._isSelecting = true;
                this._origin      = e.GetPosition(this._page);
                this._pageIndex   = fixedPanelDocumentPage.PageIndex;
            }
        }
Exemplo n.º 5
0
        private FixedDocumentPage GetFixedPanelDocumentPage(Point pt)
        {
            DocumentGrid mpScope = _scope as DocumentGrid;

            if (mpScope != null)
            {
                DocumentPage      dp  = mpScope.GetDocumentPageFromPoint(pt);
                FixedDocumentPage fdp = dp as FixedDocumentPage;
                if (fdp == null)
                {
                    FixedDocumentSequenceDocumentPage fdsdp = dp as FixedDocumentSequenceDocumentPage;
                    if (fdsdp != null)
                    {
                        fdp = fdsdp.ChildDocumentPage as FixedDocumentPage;
                    }
                }
                return(fdp);
            }
            return(null);
        }
Exemplo n.º 6
0
        // Token: 0x06003516 RID: 13590 RVA: 0x000F0AD0 File Offset: 0x000EECD0
        private FixedDocumentPage GetFixedPanelDocumentPage(Point pt)
        {
            DocumentGrid documentGrid = this._scope as DocumentGrid;

            if (documentGrid != null)
            {
                DocumentPage      documentPageFromPoint = documentGrid.GetDocumentPageFromPoint(pt);
                FixedDocumentPage fixedDocumentPage     = documentPageFromPoint as FixedDocumentPage;
                if (fixedDocumentPage == null)
                {
                    FixedDocumentSequenceDocumentPage fixedDocumentSequenceDocumentPage = documentPageFromPoint as FixedDocumentSequenceDocumentPage;
                    if (fixedDocumentSequenceDocumentPage != null)
                    {
                        fixedDocumentPage = (fixedDocumentSequenceDocumentPage.ChildDocumentPage as FixedDocumentPage);
                    }
                }
                return(fixedDocumentPage);
            }
            return(null);
        }
        // Token: 0x06002CE2 RID: 11490 RVA: 0x000CA868 File Offset: 0x000C8A68
        private void OnGetPageRootCompleted(object sender, GetPageRootCompletedEventArgs args)
        {
            PageContent pageContent = (PageContent)sender;

            pageContent.GetPageRootCompleted -= this.OnGetPageRootCompleted;
            this._pendingPages.Remove(pageContent);
            ArrayList arrayList = new ArrayList();
            IEnumerator <KeyValuePair <object, FixedDocument.GetPageAsyncRequest> > enumerator = this._asyncOps.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <object, FixedDocument.GetPageAsyncRequest> keyValuePair = enumerator.Current;
                    FixedDocument.GetPageAsyncRequest value = keyValuePair.Value;
                    if (value.PageContent == pageContent)
                    {
                        ArrayList arrayList2 = arrayList;
                        keyValuePair = enumerator.Current;
                        arrayList2.Add(keyValuePair.Key);
                        DocumentPage page = DocumentPage.Missing;
                        if (!value.Cancelled && !args.Cancelled && args.Error == null)
                        {
                            FixedPage result    = args.Result;
                            Size      fixedSize = this.ComputePageSize(result);
                            page = new FixedDocumentPage(this, result, fixedSize, this.Pages.IndexOf(pageContent));
                        }
                        this._NotifyGetPageAsyncCompleted(page, value.PageNumber, args.Error, value.Cancelled, value.UserState);
                    }
                }
            }
            finally
            {
                foreach (object key in arrayList)
                {
                    this._asyncOps.Remove(key);
                }
            }
        }
        // Token: 0x06002CBD RID: 11453 RVA: 0x000C9BA4 File Offset: 0x000C7DA4
        internal DocumentPage GetPage(int pageNumber)
        {
            if (pageNumber < 0)
            {
                throw new ArgumentOutOfRangeException("pageNumber", SR.Get("IDPNegativePageNumber"));
            }
            if (pageNumber >= this.Pages.Count)
            {
                return(DocumentPage.Missing);
            }
            FixedPage fixedPage = this.SyncGetPage(pageNumber, false);

            if (fixedPage == null)
            {
                return(DocumentPage.Missing);
            }
            Size size = this.ComputePageSize(fixedPage);
            FixedDocumentPage result = new FixedDocumentPage(this, fixedPage, size, pageNumber);

            fixedPage.Measure(size);
            fixedPage.Arrange(new Rect(default(Point), size));
            return(result);
        }
Exemplo n.º 9
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors
        internal FixedTextView(FixedDocumentPage docPage)
        {
            _docPage = docPage;
        }
Exemplo n.º 10
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors
        internal FixedTextView(FixedDocumentPage  docPage)
        {
            _docPage = docPage;
        }
Exemplo n.º 11
0
        /// <summary>
        /// <see cref="System.Windows.Documents.DocumentPaginator.GetPage(int)"/>
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">pageNumber is less than zero.</exception>
        /// <param name="pageNumber">
        /// The page number.
        /// </param>
        internal DocumentPage GetPage(int pageNumber)
        {
            DocumentsTrace.FixedFormat.IDF.Trace(string.Format("IDP.GetPage({0})", pageNumber));

            // Make sure that the call is in the right context.
//             Dispatcher.VerifyAccess();

            // Page number cannot be negative.
            if (pageNumber < 0)
            {
                throw new ArgumentOutOfRangeException("pageNumber", SR.Get(SRID.IDPNegativePageNumber));
            }

            if (pageNumber < Pages.Count)
            {
                //
                // If we are not out of bound, try next page
                //
                FixedPage page = SyncGetPage(pageNumber, false/*forceReload*/);

                if (page == null)
                {
                    return DocumentPage.Missing;
                }

                Debug.Assert(page != null);
                Size fixedSize = ComputePageSize(page);

                // Always measure with fixed size instead of using constraint
                FixedDocumentPage dp = new FixedDocumentPage(this, page, fixedSize, pageNumber);

                page.Measure(fixedSize);
                page.Arrange(new Rect(new Point(), fixedSize));

                return dp;
            }

            return DocumentPage.Missing;
        }
Exemplo n.º 12
0
        private void OnGetPageRootCompleted(object sender, GetPageRootCompletedEventArgs args)
        {
            DocumentsTrace.FixedFormat.IDF.Trace(string.Format("IDP.OnGetPageRootCompleted {0}", Pages.IndexOf((PageContent)sender)));
            // Mark this page as no longer pending
            PageContent pc = (PageContent)sender;
            pc.GetPageRootCompleted -= new GetPageRootCompletedEventHandler(OnGetPageRootCompleted);
            _pendingPages.Remove(pc);

            // Notify all outstanding request for this particular page
            ArrayList completedRequests = new ArrayList();
            IEnumerator<KeyValuePair<Object, GetPageAsyncRequest>> ienum = _asyncOps.GetEnumerator();
            try
            {
                while (ienum.MoveNext())
                {
                    GetPageAsyncRequest asyncRequest = ienum.Current.Value;
                    // Process any outstanding request for this PageContent
                    if (asyncRequest.PageContent == pc)
                    {
                        completedRequests.Add(ienum.Current.Key);
                        DocumentPage result = DocumentPage.Missing;
                        if (!asyncRequest.Cancelled)
                        {
                            // Do synchronous measure since we have obtained the page
                            if (!args.Cancelled && (args.Error == null))
                            {
                                FixedPage c = (FixedPage)args.Result;
                                Size fixedSize = ComputePageSize(c);

//                              Measure / Arrange in GetVisual override of FixedDocumentPage, not here
                                result = new FixedDocumentPage(this, c, fixedSize, Pages.IndexOf(pc));
                            }
                        }
                        // this could throw
                        _NotifyGetPageAsyncCompleted(result, asyncRequest.PageNumber, args.Error, asyncRequest.Cancelled, asyncRequest.UserState);
                    }
                }
            }
            finally
            {
                // Remove completed requests from current async ops list
                foreach (Object userState in completedRequests)
                {
                    _asyncOps.Remove(userState);
                }
            }
        }