asposediagram.api

Class Protection

Locking helps prevent inadvertent changes to the shape but does not prevent Microsoft Visio from resetting values in other circumstances. It also does not protect against changes made in the ShapeSheet window.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram("ProtectAndUnprotect.vsd");

// get page by name
page = diagram.getPages().getPage("Flow 1");
// get shape by ID
shape = page.getShapes().getShape(1);

// set protections
shape.getProtection().getLockAspect().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockBegin().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockCalcWH().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockCrop().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockCustProp().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockDelete().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockEnd().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockFormat().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockFromGroupFormat().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockGroup().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockHeight().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockMoveX().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockMoveY().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockRotate().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockSelect().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockTextEdit().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockThemeColors().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockThemeEffects().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockVtxEdit().setValue(aspose.diagram.BOOL.TRUE);
shape.getProtection().getLockWidth().setValue(aspose.diagram.BOOL.TRUE);

diagram.save("out-VisioShapeProtection.vdx", aspose.diagram.SaveFileFormat.VDX);

Property Getters/Setters Summary
methodgetDel()
method
setDel(value)
           A flag indicating whether the element has been deleted locally. A value of 1 indicates that the element was deleted locally. The value of the property is BOOL integer constant.
methodgetLockAspect()
Specifies whether the aspect ratio of the shape is locked. If locked, the shape can only be sized proportionally; it cannot be sized in a single dimension.
methodgetLockBegin()
Specifies whether the begin point of a 1-D shape is locked to a specific location.
methodgetLockCalcWH()
Specifies whether a shape's selection rectangle is locked so it cannot be recalculated when a vertex is edited or an element type is changed in the Geom element.
methodgetLockCrop()
Specifies whether a foreign object is locked against being cropped with the Crop tool in Microsoft Visio.
methodgetLockCustProp()
Determines whether the user can add, delete, or modify custom properties in the user interface (UI) by using the Define Custom Properties dialog box.
methodgetLockDelete()
Specifies whether a shape is locked against being deleted.
methodgetLockEnd()
Specifies whether the end point of a 1-D shape is locked to a specific location.
methodgetLockFormat()
Specifies whether the formatting of a shape is locked so it cannot be changed. Specifically, this element protects against changing text, line, and fill formatting, or changing which Style element the shape inherits from.
methodgetLockFromGroupFormat()
Allows a subshape to block formatting changes that get applied to a parent group shape in the Visio user interface and would otherwise cascade down to individual group shapes.
methodgetLockGroup()
Specifies whether a group is locked so that it cannot be ungrouped.
methodgetLockHeight()
Specifies whether the height of the shape is locked. If locked, its height remains unchanged when the shape is resized.
methodgetLockMoveX()
Specifies whether the horizontal position of the shape is locked so that it cannot be moved horizontally.
methodgetLockMoveY()
Specifies whether the vertical position of the shape is locked so that it cannot be moved vertically.
methodgetLockRotate()
Specifies whether the shape is locked against being rotated with the Rotation tool or the Rotate Left or Rotate Right commands in Microsoft Visio.
methodgetLockSelect()
Specifies whether a shape's selection rectangle is locked so it cannot be recalculated when a vertex is edited or an element type is changed in the Geom element.
methodgetLockTextEdit()
Specifies whether the text of a shape is locked so that it cannot be edited. However, the text may still be formatted by applying a style, using the Style options on the Font tab of the Text dialog box.
methodgetLockThemeColors()
Prevents users from applying theme colors to the shape.
methodgetLockThemeEffects()
Prevents users from applying theme effects to the shape.
methodgetLockVtxEdit()
Specifies whether the vertices of a shape are locked so that they cannot be edited with any tools on the toolbar.
methodgetLockWidth()
Specifies whether the width of the shape is locked so that it remains unchanged when the shape is resized.
 

    • Property Getters/Setters Detail

      • getDel/setDel : int 

        int getDel() / setDel(value)
        
        A flag indicating whether the element has been deleted locally. A value of 1 indicates that the element was deleted locally. The value of the property is BOOL integer constant.
      • getLockWidth : BoolValue 

        BoolValue getLockWidth()
        
        Specifies whether the width of the shape is locked so that it remains unchanged when the shape is resized.
      • getLockHeight : BoolValue 

        BoolValue getLockHeight()
        
        Specifies whether the height of the shape is locked. If locked, its height remains unchanged when the shape is resized.
      • getLockMoveX : BoolValue 

        BoolValue getLockMoveX()
        
        Specifies whether the horizontal position of the shape is locked so that it cannot be moved horizontally.
      • getLockMoveY : BoolValue 

        BoolValue getLockMoveY()
        
        Specifies whether the vertical position of the shape is locked so that it cannot be moved vertically.
      • getLockAspect : BoolValue 

        BoolValue getLockAspect()
        
        Specifies whether the aspect ratio of the shape is locked. If locked, the shape can only be sized proportionally; it cannot be sized in a single dimension.
      • getLockDelete : BoolValue 

        BoolValue getLockDelete()
        
        Specifies whether a shape is locked against being deleted.
      • getLockBegin : BoolValue 

        BoolValue getLockBegin()
        
        Specifies whether the begin point of a 1-D shape is locked to a specific location.
      • getLockEnd : BoolValue 

        BoolValue getLockEnd()
        
        Specifies whether the end point of a 1-D shape is locked to a specific location.
      • getLockRotate : BoolValue 

        BoolValue getLockRotate()
        
        Specifies whether the shape is locked against being rotated with the Rotation tool or the Rotate Left or Rotate Right commands in Microsoft Visio.
      • getLockCrop : BoolValue 

        BoolValue getLockCrop()
        
        Specifies whether a foreign object is locked against being cropped with the Crop tool in Microsoft Visio.
      • getLockVtxEdit : BoolValue 

        BoolValue getLockVtxEdit()
        
        Specifies whether the vertices of a shape are locked so that they cannot be edited with any tools on the toolbar.
      • getLockTextEdit : BoolValue 

        BoolValue getLockTextEdit()
        
        Specifies whether the text of a shape is locked so that it cannot be edited. However, the text may still be formatted by applying a style, using the Style options on the Font tab of the Text dialog box.
      • getLockFormat : BoolValue 

        BoolValue getLockFormat()
        
        Specifies whether the formatting of a shape is locked so it cannot be changed. Specifically, this element protects against changing text, line, and fill formatting, or changing which Style element the shape inherits from.
      • getLockGroup : BoolValue 

        BoolValue getLockGroup()
        
        Specifies whether a group is locked so that it cannot be ungrouped.
      • getLockCalcWH : BoolValue 

        BoolValue getLockCalcWH()
        
        Specifies whether a shape's selection rectangle is locked so it cannot be recalculated when a vertex is edited or an element type is changed in the Geom element.
      • getLockSelect : BoolValue 

        BoolValue getLockSelect()
        
        Specifies whether a shape's selection rectangle is locked so it cannot be recalculated when a vertex is edited or an element type is changed in the Geom element.
      • getLockCustProp : BoolValue 

        BoolValue getLockCustProp()
        
        Determines whether the user can add, delete, or modify custom properties in the user interface (UI) by using the Define Custom Properties dialog box.
      • getLockFromGroupFormat : BoolValue 

        BoolValue getLockFromGroupFormat()
        
        Allows a subshape to block formatting changes that get applied to a parent group shape in the Visio user interface and would otherwise cascade down to individual group shapes.
      • getLockThemeColors : BoolValue 

        BoolValue getLockThemeColors()
        
        Prevents users from applying theme colors to the shape.
      • getLockThemeEffects : BoolValue 

        BoolValue getLockThemeEffects()
        
        Prevents users from applying theme effects to the shape.