pub struct OleObjectShape { /* private fields */ }Expand description
高阶 OLE 对象形状(承载 <p:graphicFrame> + <p:oleObj r:id="..."/> 引用)。
通过 OleObjectShape::ole / OleObjectShape::ole_mut 访问 OLE 数据模型;
通过 Shape trait 方法(left / top / width / height)调整位置与尺寸。
§内部不变量
frame.graphic 始终保持为 Graphic::OleObject(_)。本类型所有便捷方法
(rid / set_rid / image_rid / prog_id / name / show_as_icon)
在不变量被破坏时静默忽略或返回默认值,绝不 panic——
这与库整体“零 panic“约定一致(参见 .trae/rules/project_rules.md §5)。
Implementations§
Source§impl OleObjectShape
impl OleObjectShape
Sourcepub fn new(prog_id: impl Into<String>, name: impl Into<String>) -> Self
pub fn new(prog_id: impl Into<String>, name: impl Into<String>) -> Self
构造一个指定 progId 与显示名的 OLE 对象形状(rid/image_rid 留空,由 presentation 层填充)。
§参数
prog_id:OLE 程序标识符(如"Excel.Sheet.12"/"Package")。name:显示名(如"Worksheet")。
Sourcepub fn from_frame(frame: OxmlFrame) -> Self
pub fn from_frame(frame: OxmlFrame) -> Self
从 oxml Frame 构造(通常用于读取已有 OLE 对象时)。
Sourcepub fn ole(&self) -> Option<&OxmlOleObject>
pub fn ole(&self) -> Option<&OxmlOleObject>
取内部 oxml OleObject 引用。
返回 None 仅在内部不变量被外部错误破坏时(frame.graphic 不是 OleObject 变体)。
Sourcepub fn ole_mut(&mut self) -> Option<&mut OxmlOleObject>
pub fn ole_mut(&mut self) -> Option<&mut OxmlOleObject>
取内部 oxml OleObject 可变引用。
Sourcepub fn rid(&self) -> &str
pub fn rid(&self) -> &str
当前关联的 OLE 关系 id(指向 /ppt/embeddings/oleObjectN.bin)。
新建时为空字符串;由 Presentation::to_opc_package 在写出 ole part 时填充。
不变量被破坏时返回空字符串。
Sourcepub fn set_rid(&mut self, rid: impl Into<String>)
pub fn set_rid(&mut self, rid: impl Into<String>)
设置 OLE 关系 id(一般由 presentation 层自动调用,用户无需直接设置)。 不变量被破坏时静默忽略。
Sourcepub fn image_rid(&self) -> &str
pub fn image_rid(&self) -> &str
当前关联的图标图片关系 id(指向 /ppt/media/imageN.{ext})。
空字符串表示无图标图片,PowerPoint 会用默认图标显示。 不变量被破坏时返回空字符串。
Sourcepub fn set_image_rid(&mut self, rid: impl Into<String>)
pub fn set_image_rid(&mut self, rid: impl Into<String>)
设置图标图片关系 id。不变量被破坏时静默忽略。
Sourcepub fn set_prog_id(&mut self, prog_id: impl Into<String>)
pub fn set_prog_id(&mut self, prog_id: impl Into<String>)
修改 OLE 程序标识符。不变量被破坏时静默忽略。
Sourcepub fn set_ole_name(&mut self, name: impl Into<String>)
pub fn set_ole_name(&mut self, name: impl Into<String>)
修改显示名。不变量被破坏时静默忽略。
Sourcepub fn show_as_icon(&self) -> bool
pub fn show_as_icon(&self) -> bool
是否以图标形式显示。
不变量被破坏时返回 true(与默认值一致)。
Sourcepub fn set_show_as_icon(&mut self, show: bool)
pub fn set_show_as_icon(&mut self, show: bool)
设置是否以图标形式显示。不变量被破坏时静默忽略。
Sourcepub fn set_icon_size(&mut self, width: Emu, height: Emu)
pub fn set_icon_size(&mut self, width: Emu, height: Emu)
设置图标显示尺寸(EMU)。 不变量被破坏时静默忽略。
Sourcepub fn set_pic_id_name(&mut self, id: u32, name: impl Into<String>)
pub fn set_pic_id_name(&mut self, id: u32, name: impl Into<String>)
设置图标 Pic 形状的 id 与 name(用于 <p:oleObj spid="..."> 与 <p:cNvPr name="...">)。
不变量被破坏时静默忽略。
Sourcepub fn set_placeholder(&mut self, ph_idx: u32, ph_type: Option<&str>)
pub fn set_placeholder(&mut self, ph_idx: u32, ph_type: Option<&str>)
将本 OLE 对象形状标记为占位符。
写出 XML 时会在 <p:nvGraphicFramePr>/<p:nvPr> 内插入
<p:ph type="obj" idx="..."/>,使 PowerPoint 把该 graphicFrame
识别为对象占位符的填充实例。
§参数
ph_idx:占位符索引(对应<p:ph idx="..."/>)。ph_type:占位符类型字符串(如"obj"),None时省略type属性。
Sourcepub fn clear_placeholder(&mut self)
pub fn clear_placeholder(&mut self)
清除占位符标记,使本 OLE 对象形状变为普通 graphicFrame。
Sourcepub fn is_placeholder(&self) -> bool
pub fn is_placeholder(&self) -> bool
是否被标记为占位符。
Trait Implementations§
Source§impl Clone for OleObjectShape
impl Clone for OleObjectShape
Source§fn clone(&self) -> OleObjectShape
fn clone(&self) -> OleObjectShape
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OleObjectShape
impl Debug for OleObjectShape
Source§impl Default for OleObjectShape
impl Default for OleObjectShape
Source§fn default() -> OleObjectShape
fn default() -> OleObjectShape
Source§impl Shape for OleObjectShape
impl Shape for OleObjectShape
Source§fn rotation(&self) -> f64
fn rotation(&self) -> f64
OLE 对象不支持旋转(OOXML 规范)。调用 Shape::set_rotation 会被忽略。