Find shape and bring to front (P)

Modified on Mon, 5 Oct at 1:54 PM

With BaseExtensions, we are able to search for a specific shape on the current layout or on specified layout, copy it and then bring it to front at the same location in the presentation. For instance, this is handy if an inserted image covers an existing logo. With just one click, the logo will be brought to front and be on top of the inserted image.

Notice that this function will run for layouts that are present in the presentation only.

Module is located here:

Code
...\ModuleLibrary\BaseExtensions\01_nocontext_Tools\70_P_bringShapeToFront.xml

CMD

<Cmd case="BaseExtensions:find-shape-bring-to-front"/>

Parameters

selectedSlide

Define this parameter to be true if the command should run for the selected slide(s).

layout-X-name

Define the name of the master layout in which the shape is located. The X in this parameter is an identifier.

shape-X-name-Y

Define the name of the shape on the layout matched with same X. Y refers to the id of a shape.

forceLayoutMapping

This parameter will force mapping of shape to layout. Can be set to "true" or "false".

copyDelete

Define this parameter to be true if the command should delete shapes from slide that has already been inserted. Then it will copy/paste the shape with the given name (from the command) from custom layout to slide but only if it is visible in custom layout.

allLayouts

Define this parameter to true if the command should map all shape names defined to all custom layouts. When this parameter is true, there is no need for defining the layout names, just shape names. This can continue to be shape-x-name-y.

If two modules exists, where one is allLayouts="true" and another has defined specific layouts to map to, then it is needed for the one with defined layouts to include forceLayoutMapping="true" to ensure that when differentiating between the two modules that the mapping is remapped to current context.

Omit this parameter if it should be false.

deleteFromMaster

Define this parameter to true if the command should delete the shape(s) from the master slide that has been copied. This will also fix so there will be no duplicated shapes.

Omit this parameter if it should be false.

Example of usage

In the example below, there are several layouts and shapes (logos), thus X are increased for every case. In the slide master, each layout has its own logo and all of these are called image, which makes Y remain 1. If you add the slide "Divider and Picture" to your presentation and inserts a picture that covers the logo, the command will go to the custom layout "Divider and Picture" in the slide master, copy the shape called image and insert it at the exact same location. In this way, the logo will be brought to front.

XML
<Cmd case="BaseExtensions:find-shape-bring-to-front" selectedSlide="true"
  layout-1-name="3 Pictures no margin"
  shape-1-name-1="image"
  shape-1-name-2="logo"

  layout-2-name="4 Pictures no margin"
  shape-2-name-1="image"
 
  layout-3-name="6 Pictures no margin"
  shape-3-name-1="image"
 
  layout-4-name="Divider and Picture"
  shape-4-name-1="image"
/>

Example of event that brings logo forward in Templafy template

XML
<event type="BaseExtensions:NewDocument" showInExcel="false" showInPowerPoint="true" showInWord="false" showInOutlook="false">	
    <Cmd case="BaseExtensions:If" 
	if-1-type="docpropmap" 
	if-1-key="TemplafyTenantId" 
	if-1-value="+clientname"
	if-1-key-2="HasRun" 
	if-1-value-2="-true"
	>
	<True>	
           <Cmd case="BaseExtensions:find-shape-bring-to-front" 
		layout-1-name="Front Page"
		shape-1-name-1="LogoImage"	
	   />	
        </True>
     </Cmd>
</event>

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article