CPAN::Forum
OpenOffice-OODoc - Re: How to distinguish lists correctly?
| Posted on Sat Jun 3 12:17:25 2006 by jmgdoc in response to 2407 (See the whole thread of 8) |
| Re: How to distinguish lists correctly? |
|
The getStyleElement() and getStyleList(), without any other argument than the style name, can retrieve only the styles having the default namespace and the default type. The namespace and type options are mandatory in order to select another search space. For an OpenDocument list style, the namespace is 'text' and the type is 'list-style' (don't ask me why). So, you could get a 'L1' style element like that:
$s = $doc->getStyleElement
("L1", namespace => 'text', type => 'list-syle');
However, a list style is more a style container than a real style. It hosts a set of specialized styles, typically one per possible hierarchical level in the list, whose namespace is 'text' and type is 'list-level-style-bullet' or 'list-level-style-number'. Each level style controls the item numbering logic, the bullet character, the space between the number/bullet and the text, and so on. Dealing with this kind of plumbing is a tricky business, and the present methods of OODoc are not really tailored to easily work with the styles of complex elements such as tables and lists. The more practical way consists of creating a the needed list style through the OpenOffice.org GUI and using it as a template. However, the best way to distinguish "bulleted" lists and "numbered" lists consists of looking for the 'list-level-style-bullet' or 'list-level-style-number' children of the given list style. Remember that a list style doesn't control the way the item texts are displayed. Each individual list item contains a paragraph which depends on a regular paragraph style. The paragraph style of an item can be reached using getItemList(), described in the O::O::Text man page. |
| Write a response |
(4)
]