Update tocmodel to support read/write to buffer

Registered by Rob Oakes

Development Goal: Update the existing LyX toc-model so that it can both read and write to the document buffer.

(For more information about the larger LyX-Outline project, see http://www.oak-tree.us/blog/index.php/science-and-technology/lyx-outline. This page also includes a working prototype that demonstrates the type of experience that I would like to incorporate into LyX.)

Background: At the present time, the model that LyX uses to display it's table of contents, figures, tables, etc. in the "Outline View" only supports the reading of information. This is because it only partially implements the methods of QStandardItemView. The Qt Model/View architecture, however, allows for custom views to be created that can both read and write information, if all of the necessary methods are supported.

(See http://doc.trolltech.com/4.6/qstandarditemmodel.html for more information about QStandardItemModel and http://doc.trolltech.com/4.6/model-view.html for information about the Qt Model/View classes. An introduction to the Qt Model/View architecture can be found at http://doc.trolltech.com/4.6/model-view-introduction.html)

Constraints: Due to the need to support older versions of Qt, methods or classes that are not supported in Qt 4.3 should not be used. If no workaround can be found, they should be presented to the LyX developer list prior to implementation.


1.) Determine which methods need to be added in order to support read/write in TocModel
2.) Extend the TocBackend, TocModel and dispatch classes so that they are able to make changes to the underlying buffer and update the view that the changes have been made
3.) Add new LyX functions as necessary to support the expanded classes in Item 2
4.) Test functionality with Corkboard view that has been added to LyX
5.) Create new LyX inset called synopsis that will be added to a second column in the LyX model. Create custom functions that allow for it to be updated and manipulated

Major Classes:


LyXAction.cpp: LyX makes use of a dispatch mechanism for modifying the current buffer. This class holds a list of all of the different LyX functions that are used to manipulate the buffer. For an example of a LyX function that I created, see LFUN_OUTLINE_DRAGMOVE. This function is by the corkboard to move a particular section of document by drag and drop.

Text3.cpp: Class which contains a number of LFUN implementations. They show examples of how to manipulate the LyX buffer. Includes the implementation of LFUN_OUTLINE_DRAGMOVE.

TocBackend.cpp, TocBackend.h: Contains the implementation of Toc::item, which translates buffer information into a format that can be used by QStandardItemView. Using this class to support writing to the buffer may be a good option. It would need to be updated to the setData() function and proper signal/slot mechanisms.

(See http://doc.trolltech.com/4.6/model-view-creating-models.html#making-the-model-editable for more information on creating new models.)


TocModel.cpp, TocModel.h: These are the major classes associated with LyX's model/view. They hold many of the methods involved for translating the underlying document buffer into a hierarchical data structure that can be displayed in the Outliner pane. Some of the code here may need to be refactored into the background classes so that it can be used by custom models (such as the Corkboard).

Corkboard Classes


Corkboard.cpp, Corkboard.h, CorkboardDelegates.cpp, CorkboardDelegates.h, Corkboardmanager.cpp, CorkboardManager.h, CorkbarodWidget.cpp, CorkboardWidget.h, Corkboard.cpp, GuiCorkboard.h

These classes represent a custom corkboard view that I ported from the prototype. I have implemented one custom LFUN, which allows for document sections to be moved via drag/drop.

Source Code:

Because the LyX team is currently trying to release version 2.0 and the development emphasis has shifted to finding bugs, I have created a separate launchpad branch for development (https://code.launchpad.net/~lyx-outline-devel/lyx-outline/trunk). All development work will proceed on launchpad and be merged into LyX at a later time. As bugfixes are pushed to the LyX SVN repository, I will add them to the LyX-Outline branch.

A copy of the source code can be checked out by using:

bzr branch lp:lyx-outline

Blueprint information

Rob Oakes
Needs approval
Series goal:
Good progress
Milestone target:
Started by
Rob Oakes




Work Items

This blueprint contains Public information 
Everyone can see this information.


No subscribers.