Skip to content

ODPresentation Writer : a placeholder is written as an ordinary frame, so a title stops being a title #984

Description

@dkulyk

Nothing in Writer/ODPresentation emits presentation:class. A shape marked

$shape->setPlaceHolder(new Placeholder(Placeholder::PH_TYPE_TITLE));

is written as an ordinary draw:frame, so the title of a slide stops being a title. Measured on one
report written both ways and converted by LibreOffice: the PPTX carries 6 /H elements in the
tagged PDF, the ODP none. The ODF LibreOffice itself makes of that deck holds
presentation:class="title" six times, so the format is not the limitation.

The class alone buys nothing

Measured on a two-shape deck -- one title and one body placeholder -- written by this library and
converted to a tagged PDF:

the frame carries ODF 1.2 tag tree
what the Writer emits today valid Div:2, P:2
+ presentation:class valid Div:2, P:2 -- unchanged
+ presentation:class + draw:layer="layout" valid Div:2, P:2 -- unchanged
presentation:style-name in place of draw:style-name, no class valid Div:2, P:2 -- unchanged
the class and presentation:style-name in place of draw:style-name valid Div:1, H:1, P:2
the same deck written as PPTX, for reference -- Div:1, H:1, P:2
the ODP LibreOffice makes of that PPTX -- Div:1, H:1, P:2

A title becomes a title only when the class is paired with a style of family presentation. Either
half on its own leaves the frame a paragraph.

The two style attributes are mutually exclusive

ODF 1.2 spells them as a <choice> (OpenDocument-v1.2-os-schema.rng:6412-6437):

<choice>
  <group> draw:style-name?         draw:class-names?         </group>
  <group> presentation:style-name? presentation:class-names? </group>
</choice>

A frame carries one group or the other; writing both answers with
Invalid attribute style-name for element frame. So writeTxtStyle() (Content.php:971) has to
emit pr{shapeId} of family presentation instead of gr{shapeId} of family graphic for a
placeholder, carrying the same style:graphic-properties. A replacement, not an addition.

style:parent-style-name="Default-title" is not needed: LibreOffice writes one, but measured
without it the file is valid and the /H still appears. Master pages and presentation-page-layout
stay out of this.

The map

The branch already exists -- getPlaceholderField() (Content.php:717) reads the placeholder for
text:page-number and text:date. What is added beside it is the class map, and ODF does not spell
three of the seven the way OOXML does:

Placeholder::PH_TYPE_* presentation:class
title title
body outline
subTitle subtitle
ftr footer
dt date-time
sldNum page-number
chart chart

presentation-classes in the schema (:7752-7770) is a closed list of seventeen values, so a typo
fails assertIsSchemaODF12Valid() rather than shipping.

PR to follow.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions