Skip to main content

ShapeLocks

Struct ShapeLocks 

Source
pub struct ShapeLocks {
    pub no_grp: bool,
    pub no_drilldown: bool,
    pub no_select: bool,
    pub no_change_aspect: bool,
    pub no_move: bool,
    pub no_resize: bool,
    pub no_rot: bool,
    pub no_edit_points: bool,
    pub no_adjust_handles: bool,
    pub no_change_arrowheads: bool,
    pub no_change_shape_type: bool,
    pub no_crop: bool,
}
Expand description

形状锁定属性(<a:spLocks>)。

对应 OOXML 中 <p:cNvSpPr> 内的 <a:spLocks> 元素。 所有属性均为布尔值,true 表示禁止对应操作。

对标 python-pptx 中 shape.locks 的底层支撑(python-pptx 尚未暴露高阶 API, 但读写时保留这些属性)。

Fields§

§no_grp: bool

禁止组合(noGrp="1")。

§no_drilldown: bool

禁止进入组合(noDrilldown="1")。

§no_select: bool

禁止选择(noSelect="1")。

§no_change_aspect: bool

禁止改变宽高比(noChangeAspect="1")。

§no_move: bool

禁止移动(noMove="1")。

§no_resize: bool

禁止缩放(noResize="1")。

§no_rot: bool

禁止旋转(noRot="1")。

§no_edit_points: bool

禁止编辑顶点(noEditPoints="1")。

§no_adjust_handles: bool

禁止调整手柄(noAdjustHandles="1")。

§no_change_arrowheads: bool

禁止修改箭头(noChangeArrowheads="1")。

§no_change_shape_type: bool

禁止修改形状类型(noChangeShapeType="1")。

§no_crop: bool

禁止裁剪(noCrop="1")。

Implementations§

Source§

impl ShapeLocks

Source

pub fn is_empty(&self) -> bool

是否所有属性都为 false(即无任何锁定)。

Source

pub fn write_xml(&self, w: &mut XmlWriter)

写出 <a:spLocks .../> 自闭合标签。

若所有属性均为 false,则写出(调用方应先调用 Self::is_empty 判断)。

Source

pub fn set_lock(&mut self, lock_type: LockType, locked: bool)

统一设置指定类型的锁定(TODO-027 高阶 API)。

对标 python-pptx 风格 shape.set_lock(LockType::Select, true)。 此方法是所有 no_* 字段写入器的统一入口,避免调用方记忆 12 个字段名。

§参数
  • lock_type:锁定类型(见 LockType 枚举);
  • lockedtrue 启用该锁定,false 解除该锁定。
§示例
let mut l = ShapeLocks::default();
l.set_lock(LockType::Select, true);
l.set_lock(LockType::Rotate, true);
assert!(l.no_select);
assert!(l.no_rot);
Source

pub fn get_lock(&self, lock_type: LockType) -> bool

读取指定类型的锁定状态。详见 ShapeLocks::set_lock

Trait Implementations§

Source§

impl Clone for ShapeLocks

Source§

fn clone(&self) -> ShapeLocks

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ShapeLocks

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ShapeLocks

Source§

fn default() -> ShapeLocks

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V