BaseExtensions can be used to suspend a locked content control and locking it again after a set of commands has run. This means, we are able to unlock a locked content control, make some changes and then resume the locking. For instance, there could be a shape in the locked content control in which we want to change the fill color. This shape must be selected and with just one click, the content control is unlocked, the shape color changes and the content control will be locked again.
In this way, this command must be used in conjunction with whatever action that should happen in the content controls.
Module is located here:
...\ModuleLibrary\BaseExtensions\04_nocontext_MISC\12a_W_contentControlLocks.xml
CMDs
Suspend content control locks
This command suspends the lock on the content control that is selected.
<Cmd case="BaseExtensions:SuspendContentControlLocks"/>
Parameter
title
Define the title of the content control. It is possible to insert several content controls. In that case, just separated them with a semicolon. Notice that this parameter is optional. This means, if there is no title defined, the command will suspend the lock of the selected content control.
This supports wildcards for each entry. As an example, a wildcard can be a *
.
Example: without wildcards
In this example, no wildcards are used. Hence, only content controls with a title that match exactly will be included in the search.
<Cmd case="BaseExtensions:SuspendContentControlLocks" Title="MyCC1;MyCC2;myCC3;"/>
Example 2: with wildcards
Here, wildcards are in use. Thus, all content controls with a title that starts with MyCC
will be included in the search.
<Cmd case="BaseExtensions:SuspendContentControlLocks Title="MyCC*"/>
Resume content control locks
The following command resumes the locks of the content control.
<Cmd case="BaseExtensions:ResumeContentControlLocks"/>
Use the two commands in conjunction with a command that changes the selected content. Here's an example:
<Button label="Suspend Locking">
<Cmd case="BaseExtensions:SuspendContentControlLocks"/>
<Cmd case="BaseExtensions:change-fill-color" color="0, 0, 0"/>
<Cmd case="BaseExtensions:ResumeContentControlLocks"/>
</Button>
When selecting the shape, the content control that contains this shape will be unlocked, the shape color will be changed to black and then the locking of the content control is resumed.
Unlock all content controls
The feature above that unlocks content controls is not able to unlock nested content controls. Thus, two nested locked content controls inside each other will not be unlocked when the command is called.
Therefore, we have created a command that simply removes the locks from all content controls in a document. The command takes no parameters.
<Cmd case="BaseExtensions:UnlockAllContentControls"/>
Comments
0 comments
Article is closed for comments.