Manages the bookmarks and table of content in this document viewer.
DocumentViewerBookmarks can be accessed by the Bookmarks property.
This class manages the bookmarks of the current LEADDocument set in the document viewer.
Document bookmarks and table of content is parsed from the LEADDocument set the in the viewer using the DocumentStructure class. Each is a DocumentBookmark object that specifies the properties of an entry into the table of content as well as any children items.
When the value of BookmarksContainer is not null, then it should be an existing control in the application that will be used as the parent UI element to where DocumentViewerBookmarks creates its UI controls.
The tree view control is cleared and all items that belong to the previous document are removed, if any.
If the value is false, then DocumentStructure is parsed in a background thread to read the document structure and populate the bookmarks. This is performed in a separate thread since reading document bookmarks can be time consuming and to allow the user to start interacting with the document in the viewer without waiting for all the bookmarks to be parsed. When this happens, the Operation event will fire with DocumentViewerOperation.LoadingBookmarks. This allows the application to show a user interface indication that the bookmarks are being loaded. The LEADTOOLS Document Viewer demo uses this event to show a marquee progress bar on top of the bookmarks panel. This progress bar is made visible when loading starts (the value of IsPostOperation property of the event data is false) and made invisible when the loading completes (IsPostOperation is true). IsLoading can be used to check if the background thread is currently busy loading the bookmarks.
When the bookmarks are ready (Either the background thread completes loading or the document structure was already parsed prior to setting it in the document), then DocumentViewerBookmarks will iterate through the items in the Bookmarks list of LEADDocument and creates the parents and children items that correspond to the document table of content.
The tree view control can be accessed through TreeView. DocumentViewerBookmarks handles all the necessary mouse/touch and keyboard events to handle the user interface interaction with the bookmarks. When the user clicks on a bookmarks or presses "Enter" while the control has the focus and a selected item, then the following occurs:
The Operation fires with DocumentViewerOperation.GotoBookmark, the selected DocumentBookmark in Data1 and IsPostOperation set to false. This allows the application to intercept this event and change the default behavior by setting the value of Abort to true.
If the user did not abort the operation, GotoBookmark is called with the selected DocumentBookmark object. The viewer will perform the action of the bookmark Target and go to the specified target page and uses the optional fit and zoom percentage specified.
For an example, refer to DocumentViewer.