Download Adobe InDesign 2 Programming Guide

Transcript
584
19.4. Style Name Tables
Working with Text Styles
figure 19.3.a. Set of Paragraph styles within a document.
root style
style 3
style 1
right justification
drop cap (1 char 2 lines)
style 2
centre justification
style 4
single line composer
style 5
drop cap (1 char 3 lines)
centre justification
19.4. Style Name Tables
Styles
are maintained within workspaces (kWorkspaceBoss and
kDocWorkspaceBoss). Specifically they are accessed through the
IStyleNameTable interface (one exists for both the paragraph styles and
character styles in each workspace). The prototype for this interface is given in
IStyleNameTable.h
The snippet SnipInspectTextStyles.cpp dumps the names of all the paragraph
styles supported by the front-most document to the SnippetRunner’s Log
window. The snippet uses IWorkspace to get to the paragraph or characther’s
IStyleNameTable, then calls the IStyleNameTable::GetRootStyleUID() method to get
to the root of the style name table, from there, we can recursively get to all the
children of the root style.
One thing worth special attention is how we get to either paragraph or
character style name table by querying the interface (IStyleNameTable) with a
different interface IID (IID_ICHARSTYLENAMETABLE or
IID_IPARASTYLENAMETABLE).
For paragraph style name table:
InterfacePtr<IStyleNameTable>
iParaStyleNameTable(iWorkspace,IID_IPARASTYLENAMETABLE);
and for character style name table: