Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ its own format has. Compact example: `rtf/rtf_element_registry.*` +

`ElementType` is the shared enum in `src/odr/document_element.hpp`.

**Every drawing is a `frame`**, and `Frame::shape_type` says which outline it
draws β€” `none` for a plain box, else `rect`/`ellipse`/`line`/`custom`, the last
carrying its own `Frame::path`. Only odf sets anything but `none`; the other
engines funnel every shape into a plain frame, so `FrameAdapter` defaults the
three shape readers.

A **manual page break** reaches the renderer two ways, as the formats state it
two ways: `ParagraphStyle::break_before`/`break_after` for odf and ooxml, where
it is a style property, and `ElementType::page_break` for rtf and `.doc`, where
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ The release run heads these entries with the version and opens a fresh

## Unreleased

- **Breaking**: the drawing elements `Rect`, `Line`, `Circle` and `CustomShape`
are gone, with their `ElementType` values and `Element::as_rect`/`as_line`/
`as_circle`/`as_custom_shape`. Every shape is a `Frame` now, naming itself
through the new `ShapeType Frame::shape_type()` and carrying `Frame::path()`
and the new `Frame::line()`. Shapes gain `anchor_type()` and `z_index()`,
which only frames had. Mirrored in the JNI, Apple and Python bindings. No
rendered html changes. Closes #773.

## v6.14.0 - 2026-09-06

- Fixed: a semi-transparent colour wrote `rgba(0,0,0,0,501961)` where the host
Expand Down
72 changes: 23 additions & 49 deletions apple/include/OdrCoreObjC/ODRDocumentElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ typedef NS_ENUM(NSInteger, ODRElementType) {

ODRElementTypeFrame,
ODRElementTypeImage,
ODRElementTypeRect,
ODRElementTypeLine,
ODRElementTypeCircle,
ODRElementTypeCustomShape,

ODRElementTypeGroup,
} NS_SWIFT_NAME(ElementType);

typedef NS_ENUM(NSInteger, ODRShapeType) {
ODRShapeTypeNone = 0,
ODRShapeTypeRect,
ODRShapeTypeEllipse,
ODRShapeTypeLine,
ODRShapeTypeCustom,
} NS_SWIFT_NAME(ShapeType);

typedef NS_ENUM(NSInteger, ODRAnchorType) {
ODRAnchorTypeAsChar = 0,
ODRAnchorTypeAtChar,
Expand Down Expand Up @@ -265,6 +268,18 @@ NS_SWIFT_NAME(DrawingPath)
+ (instancetype)new NS_UNAVAILABLE;
@end

/// `odr::DrawingLine`: the two ends of a line shape, in the parent's space.
NS_SWIFT_NAME(DrawingLine)
@interface ODRDrawingLine : NSObject
@property(nonatomic, readonly) ODRMeasure *x1;
@property(nonatomic, readonly) ODRMeasure *y1;
@property(nonatomic, readonly) ODRMeasure *x2;
@property(nonatomic, readonly) ODRMeasure *y2;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

/// `odr::DrawingTransform`.
NS_SWIFT_NAME(DrawingTransform)
@interface ODRDrawingTransform : NSObject
Expand All @@ -282,6 +297,7 @@ NS_SWIFT_NAME(DrawingTransform)
/// `odr::Frame`.
NS_SWIFT_NAME(Frame)
@interface ODRFrame : ODRElement
@property(nonatomic, readonly) ODRShapeType shapeType;
@property(nonatomic, readonly) ODRAnchorType anchorType;
@property(nonatomic, readonly, nullable) ODRMeasure *x;
@property(nonatomic, readonly, nullable) ODRMeasure *y;
Expand All @@ -290,52 +306,10 @@ NS_SWIFT_NAME(Frame)
/// `int32_t`, boxed; `nil` when the document did not set one.
@property(nonatomic, readonly, nullable) NSNumber *zIndex;
@property(nonatomic, readonly, nullable) ODRDrawingTransform *transform;
@property(nonatomic, readonly) ODRGraphicStyle *style;
@end

/// `odr::Rect`.
NS_SWIFT_NAME(Rect)
@interface ODRRect : ODRElement
@property(nonatomic, readonly) ODRMeasure *x;
@property(nonatomic, readonly) ODRMeasure *y;
@property(nonatomic, readonly) ODRMeasure *width;
@property(nonatomic, readonly) ODRMeasure *height;
@property(nonatomic, readonly, nullable) ODRDrawingTransform *transform;
@property(nonatomic, readonly) ODRGraphicStyle *style;
@end

/// `odr::Line`.
NS_SWIFT_NAME(Line)
@interface ODRLine : ODRElement
@property(nonatomic, readonly) ODRMeasure *x1;
@property(nonatomic, readonly) ODRMeasure *y1;
@property(nonatomic, readonly) ODRMeasure *x2;
@property(nonatomic, readonly) ODRMeasure *y2;
@property(nonatomic, readonly, nullable) ODRDrawingTransform *transform;
@property(nonatomic, readonly) ODRGraphicStyle *style;
@end

/// `odr::Circle`.
NS_SWIFT_NAME(Circle)
@interface ODRCircle : ODRElement
@property(nonatomic, readonly) ODRMeasure *x;
@property(nonatomic, readonly) ODRMeasure *y;
@property(nonatomic, readonly) ODRMeasure *width;
@property(nonatomic, readonly) ODRMeasure *height;
@property(nonatomic, readonly, nullable) ODRDrawingTransform *transform;
@property(nonatomic, readonly) ODRGraphicStyle *style;
@end

/// `odr::CustomShape`.
NS_SWIFT_NAME(CustomShape)
@interface ODRCustomShape : ODRElement
@property(nonatomic, readonly, nullable) ODRMeasure *x;
@property(nonatomic, readonly, nullable) ODRMeasure *y;
@property(nonatomic, readonly) ODRMeasure *width;
@property(nonatomic, readonly) ODRMeasure *height;
@property(nonatomic, readonly, nullable) ODRDrawingTransform *transform;
/// `nil` for a shape whose geometry we cannot read, leaving its box.
@property(nonatomic, readonly, nullable) ODRDrawingPath *path;
/// The ends of an `ODRShapeTypeLine`, which states them instead of a box.
@property(nonatomic, readonly, nullable) ODRDrawingLine *line;
@property(nonatomic, readonly) ODRGraphicStyle *style;
@end

Expand Down
Loading
Loading