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
19 changes: 19 additions & 0 deletions crates/office2pdf/src/ir/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,20 @@ pub struct Shape {
pub enum ShapeKind {
Rectangle,
Ellipse,
/// Straight line from `(x1,y1)` to `(x2,y2)` in points, relative to element's top-left.
Line {
x1: f64,
y1: f64,
x2: f64,
y2: f64,
head_end: ArrowHead,
tail_end: ArrowHead,
},
/// Multi-segment polyline in points, relative to element's top-left.
Polyline {
points: Vec<(f64, f64)>,
head_end: ArrowHead,
tail_end: ArrowHead,
},
/// Rectangle with rounded corners. `radius_fraction` is relative to `min(width, height)`.
RoundedRectangle {
Expand All @@ -460,6 +471,14 @@ pub enum ShapeKind {
},
}

/// Arrowhead decoration on a line endpoint.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ArrowHead {
#[default]
None,
Triangle,
}

#[cfg(test)]
#[path = "elements_tests.rs"]
mod tests;
7 changes: 4 additions & 3 deletions crates/office2pdf/src/parser/pptx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use zip::ZipArchive;
use crate::config::ConvertOptions;
use crate::error::{ConvertError, ConvertWarning};
use crate::ir::{
Alignment, Block, BorderLineStyle, BorderSide, CellBorder, CellVerticalAlign, Chart, Color,
Document, FixedElement, FixedElementKind, FixedPage, GradientFill, ImageCrop, ImageData,
Alignment, ArrowHead, Block, BorderLineStyle, BorderSide, CellBorder, CellVerticalAlign, Chart,
Color, Document, FixedElement, FixedElementKind, FixedPage, GradientFill, ImageCrop, ImageData,
ImageFormat, Insets, LineSpacing, List, ListItem, ListKind, ListLevelStyle, Page, PageSize,
Paragraph, ParagraphStyle, Run, Shadow, Shape, ShapeKind, SmartArt, SmartArtNode, StyleSheet,
Table, TableCell, TableRow, TextBoxData, TextBoxVerticalAlign, TextDirection, TextStyle,
Expand All @@ -25,7 +25,8 @@ use self::package::{load_theme, parse_presentation_xml, parse_rels_xml, read_zip
#[cfg(test)]
use self::package::{resolve_relative_path, scan_chart_refs};
use self::shapes::{
parse_group_shape, parse_src_rect, pptx_dash_to_border_style, prst_to_shape_kind,
parse_arrow_head, parse_group_shape, parse_src_rect, pptx_dash_to_border_style,
prst_to_shape_kind,
};
use self::slides::{parse_single_slide, parse_slide_xml};
use self::tables::{parse_pptx_table, scale_pptx_table_geometry_to_frame};
Expand Down
Loading
Loading