57 Commits
Author SHA1 Message Date
kiwi4boy d54f840b8f craft-ppt-binary: check the hostile-text fixture reads before mutating it
If the fixture stopped reaching the text reader, every mutated copy could
fail early and the sweep would still pass. Import it whole first and
check its slide text and the master's title style.
2026-11-20 17:17:18 -05:00
kiwi4boy bbd4b02c89 craft-ppt-binary: match outlines to polygons by trying every assignment
First-fit could reject shapes that do all fit: a shape that fits two
polygons could take the one another shape needs. check_outlines now
uses bipartite matching (match_outlines), with a test of that case and
of two shapes moved onto one place.
2026-11-20 17:14:39 -05:00
kiwi4boy 92e4cab2d3 craft-ppt-binary: say unknown master placeholders are left out; match each outline to its own polygon
The module doc said a placeholder of an unknown type keeps its text as a
text box, which is true on slides only: the master leaves it out.

check_outlines let two shapes match the same rendered polygon, so two
shapes moved onto one place still passed. Each shape now takes a polygon
of its own.
2026-11-20 17:07:40 -05:00
kiwi4boy b24ed4e42a Merge branch 'ppt95-shapes' into ppt95-media 2026-11-20 02:56:29 -05:00
kiwi4boy 8f14a19169 ppt95: share the trapezoid outline with the PowerPoint 97 path
#2492 landed, so the PowerPoint 95 path's copy of OfficeArt's trapezoid
outline now uses geom::trapezoid. A negative adjust value is 0 on both.
2026-11-20 02:56:26 -05:00
kiwi4boy c53d43acd1 Merge branch 'ppt95-text' into ppt95-shapes
# Conflicts:
#	crates/ppt-binary/src/geom.rs
2026-11-20 02:56:01 -05:00
kiwi4boy bb829867fa Merge remote-tracking branch 'origin/main' into ppt95-text 2026-11-20 02:54:29 -05:00
kiwi4boy 25b3898e41 Merge branch 'ppt95-shapes' into ppt95-media
# Conflicts:
#	crates/ppt-binary/src/ppt95.rs
2026-11-20 02:38:26 -05:00
kiwi4boy 05121acf29 ppt95: decide upright text from the shape's final angle
Whether a shape's text is upright was decided from the quarter-turns
before shape::geometry ran, but geometry gives a mirrored trapezoid a
half-turn of its own, so its text turned upside down with it. The text
is now upright, at its own angle, whenever the shape ends at any other
angle. Probes of trapezoids turned and flipped before and after their
text was typed all end at the text's own angle, as PowerPoint 95 drew
them.
2026-11-20 02:37:52 -05:00
kiwi4boy 5c6239f7fe Merge branch 'ppt95-shapes' into ppt95-media 2026-11-20 02:23:38 -05:00
kiwi4boy 91032e78b0 Merge branch 'ppt95-text' into ppt95-shapes 2026-11-20 02:23:26 -05:00
kiwi4boy 6571b28594 Merge branch 'ppt95' into ppt95-text 2026-11-20 02:23:15 -05:00
kiwi4boy b122ba51dd ppt-binary: a PowerPoint 95 slide whose SlideAtom was cut short is lost too
A stream cut just after the SlideAtom's header left an atom with no
body, which counted as kept: the slide read blank and nothing was named
lost. A slide is now kept only when its atom gives its id and its
master's.
2026-11-20 02:23:13 -05:00
kiwi4boy 70b6613f0d ppt95: a metafile whose header gives a size smaller than itself is not one
metafile() fell back to the whole record when the header's size was
smaller than the 18-byte header, so a broken header passed as a
metafile. It is now refused, and its picture left out. The budget
warning now gives the picture's size and the bytes left, which can be
less than the 2 GiB total it named.
2026-11-20 02:19:02 -05:00
kiwi4boy 8f195d860b ppt95: a notes page's notes placeholder wins over other notes text
The notes came from the first object that was either the notes
placeholder or text of the notes type, so a notes-type shape before the
placeholder gave its text instead. The placeholder is now looked for
first, and other notes text only without one.
2026-11-20 02:15:56 -05:00
kiwi4boy f580d6ae27 Merge branch 'ppt95-shapes' into ppt95-media 2026-11-20 02:14:50 -05:00
kiwi4boy ebd664b8be ppt95 tests: read each WMF record within its size; drop only repeated outline vertices
The samples test's WMF reader took a polygon's points and a rectangle's
sides at fixed offsets, so a record shorter than its count read on into
the next one. Each record is now sliced to its stated size and skipped
when its values don't fit.

The outline matcher merged neighbouring vertices within the pen's
tolerance before comparing, so a narrow rectangle drawn with a wide pen
lost the corners of its short edges. Only exact repeats are dropped now;
the tolerance is for the comparison.
2026-11-20 02:14:43 -05:00
kiwi4boy 3d9992410d Merge branch 'ppt95-text' into ppt95-shapes
# Conflicts:
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 02:13:34 -05:00
kiwi4boy ed6d273e05 ppt-binary: an empty footer gives its look from its end mark; cap point spacing at DrawingML's
The footer row's look came from its first run, so an empty footer, date
or slide number placeholder (no runs once normalized) gave none. It now
falls back to the paragraph's end mark. This is the shared helper, so
both paths take it.

PowerPoint 95 point spacing was capped at 4000 pt, but DrawingML holds at
most 1584 and the writer clamps to that, so a larger value changed on
export. It is now capped at 1584.
2026-11-20 02:13:09 -05:00
kiwi4boy 7fd97515a7 Merge branch 'ppt95' into ppt95-text
# Conflicts:
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 02:11:30 -05:00
kiwi4boy f09e70f281 ppt-binary: a PowerPoint 95 slide cut off after its header is left out and named as lost
PowerPoint 95 writes a slide's SlideAtom first. A slide record without
one is what a file cut just after the slide's header leaves; it read as
a blank slide, and import_checked reported nothing lost. It is now left
out, as the PowerPoint 97 path leaves out the slides it lost, and named
by its position.
2026-11-20 02:11:02 -05:00
kiwi4boy e693fd7df9 Merge branch 'ppt95-shapes' into ppt95-media
# Conflicts:
#	crates/ppt-binary/src/ppt95.rs
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 02:05:43 -05:00
kiwi4boy 883fafe72a ppt95: text in a turned box keeps its own angle
PowerPoint 95 lays a shape's text out in the box the geometry holds,
turned by the text's own angle (4003 +16, the geometry's own angle in
every probe). Quarter-turns folded into that box don't turn the text: a
shape turned a quarter before its text was typed draws it upright, and
one turned on to 120 degrees after that draws it at 30 (probes wrap-before,
wrap-mix, wrap-arrow, with word wrap set in the Text Anchor dialog).

When the shape's box is turned back, its text is now upright at that
angle, with its insets on the held box's edges. That replaces remapping
the insets: in PowerPoint 16, upright text with these insets breaks into
the same lines at the same places as PowerPoint 95's renderings, while
remapped insets put an up arrow's text 18 pt off. A balloon's body cut is
taken from whichever edge of the held box its tail is on.
2026-11-20 02:05:01 -05:00
kiwi4boy bfa0a025d9 Merge branch 'ppt95-shapes' into ppt95-media 2026-11-20 01:49:43 -05:00
FredApps f7067b297c Merge pull request #2485 from keithcsqueensu/ppt95
craft-ppt-binary: read PowerPoint 95 slides, masters, layouts and backgrounds (#2317, step 1)
2026-11-20 13:49:24 +07:00
kiwi4boy 261b6e7a75 Merge branch 'ppt95-text' into ppt95-shapes 2026-11-20 01:49:23 -05:00
kiwi4boy c9eba77824 ppt-binary: a paragraph's end mark keeps the formatting at its CR, on both paths
Both paths gave a paragraph's end mark the formatting of its first
character. PowerPoint reads it from the character run at the CR (or at
the text's end for the last paragraph): a .ppt PowerPoint 16 saved, with
'AB\rCD' at 24 pt and only the first CR at 40, opens with that paragraph's
endParaRPr at 40. PowerPoint 95 gives the CR a run of its own when it
differs, so its path reads the same position.
2026-11-20 01:49:15 -05:00
kiwi4boy 313fd381c6 Merge branch 'ppt95-shapes' into ppt95-media
# Conflicts:
#	crates/ppt-binary/src/lib.rs
#	crates/ppt-binary/src/ppt95.rs
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 01:13:14 -05:00
kiwi4boy 1cf315b637 ppt95: text insets follow the unturned box; a balloon's text ends at its body
A shape turned a quarter before its text was typed holds its box and its
text rectangle turned (probes rot90thentext and rot90arrowtext). The
shape's box is turned back, so the insets now move to the unturned box's
edges with it. A balloon's box is its body, so its bottom inset is now
measured from the body's bottom (balloontext).

The samples test now reads the slide size from each file's DocumentAtom,
matches outlines vertex by vertex in order, reads rectangle records as
outlines too, and fails on a rendering it can't read. Tests that skipped
their checks on a missing slide or shape now fail instead.
2026-11-20 01:12:08 -05:00
kiwi4boy 4af95e2a75 Merge branch 'ppt95-text' into ppt95-shapes
# Conflicts:
#	crates/ppt-binary/src/lib.rs
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 01:02:34 -05:00
kiwi4boy bf729d6d02 ppt95: skip runs of no characters; the font table is the first list with a face
A zero-length run counted as one character of coverage, so a few of them
used up the runs read and a real run after them was never reached.

A font list whose only face atom was cut short gave an empty face and
still won over a later list with real faces.
2026-11-20 01:01:49 -05:00
kiwi4boy 86dde45a35 Merge branch 'ppt95' into ppt95-text
# Conflicts:
#	crates/ppt-binary/src/lib.rs
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 01:00:32 -05:00
kiwi4boy b1984522c4 ppt-binary: a PowerPoint 95 Document needs its DocumentAtom; name the slides a short file lost
The detector took any root whose first child was a Document, so an empty
Document read as a deck with no slides instead of being damaged. It now
also needs a DocumentAtom long enough for its slide count.

import_checked names the slides that count says are missing, by position,
so a cut-short file no longer reads as whole.

TooOld no longer promises every file before PowerPoint 95: a file that
isn't a compound file is NotPpt, and no earlier file was tried.
2026-11-20 00:59:29 -05:00
kiwi4boy 4be518deca ppt95: the centred-title test takes this branch's environment and stream helpers 2026-11-20 00:54:53 -05:00
kiwi4boy 40933524e4 Merge branch 'ppt95-shapes' into ppt95-media 2026-11-20 00:54:10 -05:00
kiwi4boy 08c85df8b4 Merge branch 'ppt95-text' into ppt95-shapes
# Conflicts:
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 00:54:08 -05:00
kiwi4boy e031ad06a0 ppt95: bound the paragraphs and runs text makes; a centred master title takes its ruler
Each paragraph is about 4 KB and each run about 2 KB, so a text atom of
nothing but paragraph or line breaks made gigabytes from a megabyte of
file. The document's text now makes at most 65,536 of them together and
leaves the rest out, with a warning.

A master's title placeholder of type 0x0F (a centred title) is in the
title family, but only a plain title set the title style's ruler.
2026-11-20 00:53:23 -05:00
kiwi4boy 788f610f40 Merge branch 'ppt95-shapes' into ppt95-media
# Conflicts:
#	crates/ppt-binary/src/ppt95.rs
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 00:39:04 -05:00
kiwi4boy ec51aa9d1c ppt-binary: slides with their own scheme in the PowerPoint 95 shape tests don't follow the master's
Two tests gave a slide its own colours while it still followed the master's scheme; since the
slide box's flags are read, PowerPoint 95 marks such a slide as not following.
2026-11-20 00:38:13 -05:00
kiwi4boy 82037cf1a0 Merge branch 'ppt95-text' into ppt95-shapes 2026-11-20 00:37:37 -05:00
kiwi4boy 513eecc86c Merge branch 'ppt95' into ppt95-text
# Conflicts:
#	crates/ppt-binary/README.md
#	crates/ppt-binary/src/ppt95.rs
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 00:37:32 -05:00
kiwi4boy 041ba948c8 ppt-binary: PowerPoint 95 slides follow the master's objects and scheme
The slide box's bytes at +16 and +17 are whether a slide shows the master's objects and uses the
master's colour scheme: turning the master's objects off on one slide clears the first, and giving
one slide its own scheme clears the second. A slide following the master's scheme now takes the
master's colours rather than the copy it holds.
2026-11-20 00:36:22 -05:00
kiwi4boy 7edbc2ab51 Merge branch 'ppt95-shapes' into ppt95-media
# Conflicts:
#	crates/ppt-binary/README.md
#	crates/ppt-binary/src/lib.rs
#	crates/ppt-binary/src/ppt95.rs
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 00:32:53 -05:00
kiwi4boy cfd19dcf87 Merge branch 'ppt95-text' into ppt95-shapes
# Conflicts:
#	crates/ppt-binary/README.md
#	crates/ppt-binary/src/lib.rs
#	crates/ppt-binary/src/ppt95.rs
#	crates/ppt-binary/src/ppt95/tests.rs
2026-11-20 00:29:58 -05:00
kiwi4boy 07b7c8b8fb ppt-binary: PowerPoint 95 master text styles, anchoring, spacing and justified text
Paragraph runs give line spacing, space before and space after at +52, +56 and +60: a percentage
of a line, or minus a size in points. Alignment 3 is justified. The text atom's +8 byte holds the
anchoring (top, middle or bottom, and whether it is centred across) and its +4 flags word wrap.
The Environment's 4052 atoms, one per text type, hold the master's styles, five levels each laid
out as the runs are; the title, body and other ones become the master's styles, with the margins
of the ruler the master's title and body name. All of this was learned from files PowerPoint 95
wrote.
2026-11-20 00:25:00 -05:00
kiwi4boy 2958d98e8a ppt-binary: check the PowerPoint 95 crop's right and bottom values
A sample cropped on the right and at the bottom shows the crop record's last two values in that
order, as the reader takes them; the samples check now covers it.
2026-11-19 23:53:57 -05:00
kiwi4boy e5c911b900 ppt-binary: read PowerPoint 95 pictures and notes (#2317, step 4)
PowerPoint 95 keeps a document's pictures as Windows metafiles in a slot
list inside the Environment record. A picture on a slide is a rectangle
whose link record names its slot and holds its crop. Each one now reads as
a picture shape in its box, with its crop and the line and fill PowerPoint
95 draws it with. The metafile becomes image/x-wmf media as stored, as the
PowerPoint 97 path keeps its metafiles. A slot is read once however many
shapes show it, all of them within the PowerPoint 97 path's 2 GiB budget.
A picture whose slot is missing, empty or not a metafile is left out.

Each slide's notes page sits inside the slide. The text of its notes
placeholder becomes the slide's notes. The notes master is not read.
2026-11-19 23:52:37 -05:00
kiwi4boy 79127c3c5a ppt-binary: PowerPoint 95 freeforms and groups
Freeforms (3016) now read as custom paths in their box: a move to the
first point and lines to the rest from the 3035 points, closed when the
low byte of the 3017 flag is 1, with the fill, line and shadow of their
format and, when open, the arrowheads of their 3007 atom. Points are
capped at 8192 and never read past their record; a freeform of fewer
than two points is left out. Their format's angle is not read.

Groups (3001) read as groups of their members, which keep their
absolute slide places: the group's box is the union of its members'
and is also its child space. Members are read as the page's objects
are, groups included, nested at most 32 deep, and count towards the
page's object cap.
2026-11-19 23:34:47 -05:00
kiwi4boy c8e440d125 ppt-binary: PowerPoint 95 rotation direction, orientation bits, the other 12 autoshapes and shadow offset
PowerPoint 95 measures angles counter-clockwise, so every angle is now
negated into DrawingML's clockwise rot. For shape codes of 0 and up the
transform comes from the geometry alone: the byte above the code holds
counter-clockwise quarter-turns and a horizontal mirror made after them,
which become a clockwise rot and a horizontal flip, with the box turned
back after an odd number of quarters. The rectangle, rounded rectangle
and ellipse keep taking the angle from the format, without flips. A
mirrored trapezoid is the outline wide at the top, turned a half-turn
further and unflipped, so its text stays upright; otherwise it is the
trapezoid preset.

Codes 9 to 14, the object model's shapes 13 to 24, read as right arrows
(the arrow and thick arrow, in all four directions), home plate, cube,
balloon and seal, with adjust values matched to what PowerPoint 95 drew.
A code no probe showed is a rectangle with its fill, line and text. The
shadow now falls by the format's offset at +36 and +40, clamped to 10 in,
and is half transparent when +29 says so.

The sample check compares each straight outline against the polygon in
the rendering PowerPoint 95 saved beside its file.
2026-11-19 23:13:46 -05:00
kiwi4boy e6c282e942 ppt-binary: PowerPoint 95 line styles, dashes, arrowheads, flips and quarter-turn rotation
PowerPoint 95 shapes now take their angle and both flips from the format
record (3005 +48 and +52) rather than the geometry, which holds the outline
as drawn: whole quarter-turns are folded into its box, so a box turned an
odd number of them is turned back about its centre. Lines read their width
from the line style (1 to 10 pt), their dots and dashes, and on lines the
start and end arrowheads from the 3007 atom. The shadow colour comes from
+30, with the scheme's shadow slot by default. The trapezoid, wide at the
top, is now its own outline instead of a flipped preset, so a user's flip
applies on top. Shadow offsets are still fixed at 6 pt.
2026-11-19 22:49:03 -05:00