<?xml encoding='utf-8'?>

<!--
==============
OmniOutliner 3
==============

The major changes to this version from the v3 DTD are complete.  There will be minor changes:

	- a few more elements under <settings>
	- a few more optional attributes scattered around (mostly on <item>)

The DOCTYPE should be:

<!DOCTYPE outline PUBLIC "-//omnigroup.com//DTD OUTLINE 3.0//EN" "http://www.omnigroup.com/namespace/OmniOutliner/xmloutline-v3.dtd">

The namespace is "http://www.omnigroup.com/namespace/OmniOutliner/v3"


In addition to this DTD, OmniOutliner has support for some processing instructions:

<?oo-date-format (palm|unix|formatted)?>

  'palm'; <date> elements contents are set to a numeric value representing the number of seconds since the Palm epoch (Jan 1 1904)l
  'unix'; <date> elements contents are set to a numeric value representing the number of seconds since the Palm epoch (Jan 1 1970)
  'formatted'; <date> elements contents are set to a string obtained by formatting the value according to the date format specified in the column.  Note that since this can be a lossy operation, the 'formatted' option is for writing only and serves to notify the consumer that the date formatting has already been done (for example, a HTML export XSL plugin might use this).

If this processing instruction is not present, dates are written with the string format (%Y-%m-%d %H:%M:%S %z).

<?oo-formatted-numbers?>

   This indicates that the number values have been written according to the number format of their column.  Since this is lossy in general, OO3 will refuse to load files with this instruction.  Numbers are only pre-formatted if a XSL plugin requests it.


<?oo-items-need-sorting (postpone|immediately)?>

    This is written when the outline has is 'postpone sorting' bit set during saving.  This indicates that the document isn't fully sorted.  If the value is 'immediately', the sorting will happen immediately on load, otherwise the 'postpone sorting' will bit be set on the loaded outline.  Note that if you are generating a XSL stylesheet to generate OmniOutliner files, you can use this to have OmniOutliner do sorting for you instead of doing it yourself.

<?oo-perform-style-merging?>

    If this is written, OO3 will perform automatic level style generation on the input.  OO3 normally assumes that files written with this DTD have had their styles coalesced into level styles, so this is normally writting out by XSL transforms that are converting XML with non-coalesced style information into OO3's format.  Note that this currently doesn't override the 'auto-generate-level-styles' attribute in <settings>.
    
-->


<!-- Attribute types -->
<!ENTITY % float "CDATA">
<!ENTITY % boolean "(yes | no)">
<!ENTITY % int32 "CDATA">
<!ENTITY % sort "(none | ascending | descending)">

<!-- ********************************************************************** -->
<!-- This is the root element -->
<!-- ********************************************************************** -->
<!ELEMENT outline (style-attribute-registry?, named-styles?, attachments?, settings?, editor?, outline-title?, columns, root, save-id?)>
<!ATTLIST outline xmlns CDATA "">

<!ELEMENT columns (column+)>

<!ELEMENT outline-title (text)>

<!ELEMENT root (style*, item*, conduit-settings?)>

<!ELEMENT settings (base-style?,
                    alternate-color?, horizontal-grid-color?, vertical-grid-color?,
                    page-adornment?, is-editable?, print-info?, autosave-interval?,
		    auto-generate-level-styles?)>

<!ELEMENT editor (drawer?, note-split-view?, hoisted-rows?, selected-rows?, selected-columns?, selected-characters?, toolbar?)>
<!ATTLIST editor id ID #IMPLIED>
<!ATTLIST editor content-size CDATA "{543, 453}"> <!-- Keep this in sync with +[OOWindowController defaultContentSize], must be 'width height', basically NSStringFromSize() -->
<!ATTLIST editor scroll-position CDATA "{0, 0}"> <!-- Must be {N, M}, basically the result of NSStringFromPoint() -->
<!ATTLIST editor is-spellchecking-enabled %boolean; "no">
<!ATTLIST editor outline-title-display-mode (when-hoisted | when-editing | always) "when-hoisted">
<!ATTLIST editor column-titles-display-mode (on | off | auto) "auto">  <!-- 'auto' not supported in UI yet, but the idea is that it would display if you had more than one column -->
<!ATTLIST editor ruler-visible %boolean; "no">
<!ATTLIST editor ruler-units CDATA "Inches"> <!-- Not hard coding the allowed types since we might add more, but you can do "Inches", "Centimeters", "Points" and "Picas" right now.  An unknown type will result in the user's preferred type being used. -->
<!ATTLIST editor note-display (in-line | out-of-line) "in-line">
<!ATTLIST editor inline-notes-span (topic | full) "topic">
<!ATTLIST editor status-visible %boolean; "yes">
<!ATTLIST editor should-edit-text-folded %boolean; "no">
<!ATTLIST editor hide-attachment-tags %boolean; "no">
<!ATTLIST editor vertical-scrollbar-visible-width %int32; "0">

<!ELEMENT toolbar (#PCDATA)>

<!ELEMENT note-split-view EMPTY>
<!ATTLIST note-split-view is-note-expanded %boolean; "yes">
<!ATTLIST note-split-view height %int32; "100">  <!-- Keep in sync with +[OOEditorState defaultNotesHeight] -->
<!ATTLIST note-split-view scroll-position %int32; "0">

<!ELEMENT drawer (find-term*)>
<!ATTLIST drawer display (hidden | sections | find) "hidden">
<!ATTLIST drawer width %int32; "0">  <!-- Any value less than the minimum width specified in the UI will be ignored -->
<!ATTLIST drawer preferred-edge (left | right) "left">
<!ATTLIST drawer palette-expanded %boolean; "yes">
<!ATTLIST drawer palette-height %int32; "0">
<!ATTLIST drawer scroll-position %int32; "0">
<!ATTLIST drawer find-scope (entire-document | hoisted-root) "entire-document">
<!ATTLIST drawer batch-find-expanded %boolean; "no">

<!ELEMENT hoisted-rows EMPTY> <!-- Must be its own element to be allowed to be optional since IDREFS can't be empty -->
<!ATTLIST hoisted-rows ids IDREFS #REQUIRED >

<!ELEMENT selected-rows EMPTY> <!-- Must be its own element to be allowed to be optional since IDREFS can't be empty -->
<!ATTLIST selected-rows ids IDREFS #REQUIRED >

<!ELEMENT selected-columns EMPTY> <!-- Must be its own element to be allowed to be optional since IDREFS can't be empty -->
<!ATTLIST selected-columns ids IDREFS #REQUIRED >

<!ELEMENT selected-characters EMPTY> <!-- Could be an attribute, but the other selections are elements, so... -->
<!ATTLIST selected-characters range CDATA "">  <!-- If both selected-rows and selected-columns contain one ID, then a cell is selected and this indicates, if the column is textual, the range of selected text.  If a cell is selected and this element is missing, the default is to select all the text in the cell. -->

<!ELEMENT find-term EMPTY>
<!ATTLIST find-term name CDATA #REQUIRED >

<!-- This is for use in conduit development.  Each time OO saves a file, it writes this element with a CFUUID.  The conduit can then look for this element to quickly determine whether the file has changed (rather than depending on the time stamp, for example). -->
<!ELEMENT save-id (#PCDATA)>

<!-- **************** Attachments **************** -->
<!ELEMENT attachments ((attachment)+)>
<!ELEMENT attachment EMPTY>
<!ATTLIST attachment id ID #REQUIRED>
<!ATTLIST attachment href CDATA #REQUIRED>  <!-- Name of attachment file inside file wrapper.  This is a bad name for this attribute since we don't URL encode this string.  It would have been better to name this 'name' or 'path' or something like that instead. -->
<!ATTLIST attachment type (file|image|com.adobe.pdf|movie) "file"> <!-- Exported when the XSL plugin requests it, otherwise not. 'image' means it is a image included in the OO3 file wrapper that can be rendered inline.  'movie' is used for QT movies and sound files that are in the OO3 file wrapper.  More types may be added later, so the best policy is probably to fallback to 'file' if you don't understand the given type. -->

<!-- **************** Columns **************** -->

<!ELEMENT column (style?, title, formatter?, enumeration?, note?)>
<!ATTLIST column id ID #IMPLIED>
<!ATTLIST column type (text | checkbox | date | duration | enumeration | number) #REQUIRED>
<!ATTLIST column summary (none | hidden | state | sum | average | minimum | maximum) "none">
<!ATTLIST column width CDATA #REQUIRED>
<!ATTLIST column minimum-width CDATA #REQUIRED>
<!ATTLIST column maximum-width CDATA #REQUIRED>
<!ATTLIST column text-export-width CDATA #REQUIRED>
<!ATTLIST column is-outline-column %boolean; "no">
<!ATTLIST column is-note-column %boolean; "no">
<!ATTLIST column status-sort %sort; "none">  <!-- Only valid on the outline column -->
<!ATTLIST column sort %sort; "none">
<!ATTLIST column prints %boolean; "yes" > <!-- Ignored for the note column; the note printing state is archived in the print-info -->
<!ATTLIST column sync (none | add | update) "none"> <!-- Reserved for future use -->

<!ELEMENT title (text)>  <!-- OO3 doesn't currently support fully styled column titles; this is for forwards compatibility. -->

<!ELEMENT enumeration (member*)>
<!ELEMENT member (text)>  <!-- OO3 doesn't currently support fully styled enumeration members; this is for forwards compatibility. -->
<!ATTLIST member id ID #IMPLIED>
<!ATTLIST member sync (none | add | update) "none"> <!-- Reserved for future use -->

<!ELEMENT note (text)>
<!ATTLIST note expanded %boolean; "no">

<!-- **************** Columns: Formatters **************** -->

<!-- Format string is used by number and date formatters. -->
<!ELEMENT formatter (#PCDATA)>
<!ATTLIST formatter type (number | date | duration) #REQUIRED>

<!-- These are valid when type="number"  -->
<!ATTLIST formatter thousand-separator CDATA ",">
<!ATTLIST formatter decimal-separator CDATA ".">

<!-- These are valid when type="date"  -->
<!ATTLIST formatter allow-natural-language %boolean; "no">

<!-- These are valid when type="duration" -->
<!ATTLIST formatter hours-per-day %int32; "8">
<!ATTLIST formatter hours-per-week %int32; "40">
<!ATTLIST formatter hours-per-month %int32; "160">
<!ATTLIST formatter should-use-verbose-format %boolean; "no">

<!-- **************** Styles **************** -->

<!ELEMENT style-attribute-registry ((style-attribute)+)>

<!-- TJW: style-attribute can really only contain ONE of the following, but we can't define that with MIXED mode; need XSD for this -->
<!ELEMENT style-attribute (#PCDATA|color|enum-name-table)*>
<!ATTLIST style-attribute version %int32; #REQUIRED>
<!ATTLIST style-attribute key CDATA #REQUIRED>
<!ATTLIST style-attribute group CDATA #REQUIRED>
<!ATTLIST style-attribute name CDATA #REQUIRED>
<!ATTLIST style-attribute class CDATA #REQUIRED>
<!ATTLIST style-attribute default-value CDATA "">

<!-- These are valid when class="number" -->
<!ATTLIST style-attribute integral %int32; "0">
<!ATTLIST style-attribute min %int32; "0">
<!ATTLIST style-attribute max %int32; "0">

<!ELEMENT named-styles (named-style+)>
<!ELEMENT named-style (style)>
<!ATTLIST named-style id ID #REQUIRED>
<!ATTLIST named-style name CDATA #REQUIRED>
<!ATTLIST named-style display-order %int32; "0">  <!-- Integer representing the desired display order in the UI.  This is necessary since named styles that depend upon one another are written out depth first, so the archive order of the elements can't implicitly store the display order in all cases -->
<!ATTLIST named-style sync (none | add | update) "none"> <!-- Reserved for future use -->

<!ELEMENT inherited-style EMPTY>
<!ATTLIST inherited-style idref IDREF #REQUIRED>  <!-- If present, this is used to look up the named style -->
<!ATTLIST inherited-style name CDATA #REQUIRED>  <!-- If the 'id' attribute isn't present, this will be used to look up the named style (for backwards compatibility with older files) -->

<!ELEMENT style (inherited-style*, value*)>

<!-- Really the value can have only one of the following.  Yet another place where we want XSD -->
<!ELEMENT value (#PCDATA|color)*>
<!ATTLIST value key CDATA #REQUIRED>

<!--
  The <text> element is formed of some number of paragraphs.  Note that the <p> element in OmniOutliner is NOT the <p> element from HTML; they are in different namespaces!
  
  Each paragraph is formed of a number of runs of text with the same style.
  
  Unlike other un-editable XML formats, we need to know the attributes of the area between paragraphs.  We define that the style of the last <run> of a <p> style of the area between paragraphs.  If the style of this area differs from the style of the end of text in the paragraph, then a <run> with a <style> but no <lit> can be placed at the end of the paragraph.
  
  Characters contained in a <run> take on the base style of the <text> (defined by the row/column cascade setup in OO).  Any <style> under a <run> element cascades from the base style of the <text> and the text inside the <run> element takes on the resultant attributes.
-->
<!ELEMENT text (p*)>
<!ELEMENT p (run*)>

<!ELEMENT run (style?,lit?)>

<!-- Since we need an way to preserve whitespace, we have a 'literal' element wrapped around our blocks of text.  Note that characters for our <text> element are *always* in a <lit> element.  This is easier to implement than trying to detect when there is whitespace that needs special handling and it also allows use to avoid MIXED content mode in the <style> element (and thus our DTD can be stricter). -->
<!ELEMENT lit (#PCDATA|cell)*>
<!ATTLIST lit xml:space (preserve) #FIXED "preserve">

<!ELEMENT cell EMPTY>
<!ATTLIST cell id ID #IMPLIED>
<!ATTLIST cell href CDATA "">      <!-- Any valid URL -->
<!ATTLIST cell alias CDATA "">	   <!-- base-64 encoded Mac file alias -->
<!ATTLIST cell linkback CDATA "">  <!-- LinkBack data - http://www.linkbackproject.org/ -->
<!ATTLIST cell variable CDATA "">  <!-- Update this to list the valid variable types -->
<!ATTLIST cell refid CDATA "">     <!-- ID of any attachment element (can't be IDREF since it's optional)  -->
<!ATTLIST cell expanded %boolean; "no">
<!ATTLIST cell name CDATA "">  <!-- The title of an attachment cell in the UI -->
<!ATTLIST cell type (file|link|image|com.adobe.pdf|movie) "link"> <!-- Exported when the XSL plugin requests it, otherwise not.  'link' means just a href.  'image' means it is a image included in the OO3 file wrapper that can be rendered inline.  'movie' is used for QT movies and sound files that are in the OO3 file wrapper.  More types may be added later, so the best policy is probably to fallback to 'link' if you don't understand the given type. -->
<!ATTLIST cell width %float; ""> <!-- Currently as above ("Exported when the XSL plugin requests it...").  In the future this may be read by OmniOutliner to allow scaling of attachments. -->
<!ATTLIST cell height %float; ""> <!-- Currently as above ("Exported when the XSL plugin requests it...").  In the future this may be read by OmniOutliner to allow scaling of attachments. -->
<!ATTLIST cell controller-visible %boolean; "no"> <!-- Currently as above ("Exported when the XSL plugin requests it...").  Written for movie attachments, specifying whether the movie controls appear at the bottom of the movie. -->

<!-- These two attributes are part of a workaround for the fact that NSFileWrapper doesn't preserve HFS attributes.  If the attachment itself has HFS file attributes, these are entirely ignored.  You should never generate XML that has these attributes, nor should you look at them.  Or process them.  Or even acknowledge their existence.  Go away!  Also, if you are from Apple, fix #3845899. -->
<!ATTLIST cell hfs-type CDATA "">  <!-- "'TIFF'" for example -->
<!ATTLIST cell hfs-creator CDATA "">

<!-- **************** Style values **************** -->
<!ELEMENT enum-name-table (enum-name-table-element+)>
<!ATTLIST enum-name-table default-value %int32; #REQUIRED>
<!ELEMENT enum-name-table-element EMPTY>
<!ATTLIST enum-name-table-element value %int32; #REQUIRED>
<!ATTLIST enum-name-table-element name CDATA #REQUIRED>

<!ELEMENT color EMPTY>
<!ATTLIST color r %float; "">  <!-- RGB -->
<!ATTLIST color g %float; "">
<!ATTLIST color b %float; "">
<!ATTLIST color a %float; "">  <!-- A can be with RGB, W, or CMYK -->
<!ATTLIST color w %float; "">  <!-- Greyscale 'white' -->
<!ATTLIST color c %float; "">  <!-- CMYK -->
<!ATTLIST color m %float; "">
<!ATTLIST color y %float; "">
<!ATTLIST color k %float; "">
<!ATTLIST color tiff CDATA ""> <!-- Pattern colors -->
<!ATTLIST color catalog CDATA ""> <!-- Named colors -->
<!ATTLIST color name CDATA "">

<!-- **************** Items **************** -->

<!ELEMENT item ((style)*, (values)?, (note)?, (children)?, (conduit-settings)?)>
<!ATTLIST item id ID #IMPLIED>
<!ATTLIST item expanded %boolean; "no">
<!ATTLIST item children-are-sections %boolean; "no">
<!ATTLIST item sync (none | add | update) "none"> <!-- Reserved for future use -->
<!ATTLIST item state (unchecked | checked | indeterminate | none) "unchecked">

<!ELEMENT values (text | checkbox | date | duration | number | enum | null)+>
<!ELEMENT children (item+)>

<!ELEMENT checkbox (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT duration (#PCDATA)>
<!ELEMENT number (#PCDATA)>
<!ELEMENT enum (#PCDATA)>
<!ATTLIST enum idref IDREF #REQUIRED>  <!-- If present, this is used to look up the enumeration, otherwise the PCDATA is used to look it up by name -->

<!ELEMENT null EMPTY>  <!-- Used for cells that are totally derived from their summary computation.  OO3 XSL exporters can choose to write <null> in this case (default behavior is to write all summarized values) -->

<!ELEMENT conduit-settings (conduit)*>

<!ELEMENT conduit (setting)*>
<!ATTLIST conduit name CDATA #REQUIRED> <!-- Uniquely identifies this conduit among all others in the document.  Should be a reverse-DNS identifier like "com.mycompany.myproduct" -->
<!ATTLIST conduit conduit-id CDATA ""> <!-- Uniquely identifies the object this conduit applies to (the row or document) in your external database (perhaps a Palm database).  Applications should remove remove this element when making a duplicate row. -->

<!ELEMENT setting (#PCDATA)>
<!ATTLIST setting name CDATA #REQUIRED> <!-- Uniquely identifies this setting among all others in the conduit. -->

<!-- **************** Settings **************** -->

<!ELEMENT base-style (style)>
<!ELEMENT alternate-color (color)>
<!ELEMENT horizontal-grid-color (color)>
<!ELEMENT vertical-grid-color (color)>

<!ELEMENT autosave-interval (#PCDATA)>           <!-- float, default "0.0" (use per-user global autosave interval preference) -->
<!ELEMENT auto-generate-level-styles (#PCDATA)>  <!-- "yes" or "no", default:"yes" -->

<!ELEMENT page-adornment (master-page-headers?, odd-page-headers?, even-page-headers?, first-page-headers?)>
<!ATTLIST page-adornment header-top-margin %float; "">
<!ATTLIST page-adornment footer-bottom-margin %float; "">
<!ATTLIST page-adornment mirror-margins %boolean; "no">

<!ELEMENT master-page-headers (header*, footer*)>
<!ATTLIST master-page-headers header-bottom-margin %float; "">
<!ATTLIST master-page-headers footer-top-margin %float; "">
<!ELEMENT odd-page-headers (header*, footer*)>
<!ATTLIST odd-page-headers is-active %boolean; "no">
<!ATTLIST odd-page-headers header-bottom-margin %float; "">
<!ATTLIST odd-page-headers footer-top-margin %float; "">
<!ELEMENT even-page-headers (header*, footer*)>
<!ATTLIST even-page-headers is-active %boolean; "no">
<!ATTLIST even-page-headers header-bottom-margin %float; "">
<!ATTLIST even-page-headers footer-top-margin %float; "">
<!ELEMENT first-page-headers (header*, footer*)>
<!ATTLIST first-page-headers is-active %boolean; "no">
<!ATTLIST first-page-headers header-bottom-margin %float; "">
<!ATTLIST first-page-headers footer-top-margin %float; "">

<!ELEMENT header (text)>
<!ATTLIST header location (left | center | right) #REQUIRED>
<!ELEMENT footer (text)>
<!ATTLIST footer location (left | center | right) #REQUIRED>

<!ELEMENT is-editable (#PCDATA)> <!-- "yes" or "no -->

<!-- Print info support.  Anything key in the NSPrintInfo that we can't encode nicely will get encoded as a base-64 blob of opaque data via the NSCoding protocol and written with a type of 'coded'.  Over time, more value types may be added, so readers should ignore or copy through any types they don't understand. -->
<!ELEMENT print-info (print-info-key*)>
<!ELEMENT print-info-key (#PCDATA)>
<!ATTLIST print-info-key name CDATA #REQUIRED>
<!ATTLIST print-info-key type (float|int|char|boolean|string|size|coded) #REQUIRED>
