Properties specifying how a shape or run reacts to mouse actions.
| 19 | |
| 20 | |
| 21 | class ActionSetting(Subshape): |
| 22 | """Properties specifying how a shape or run reacts to mouse actions.""" |
| 23 | |
| 24 | # -- The Subshape base class provides access to the Slide Part, which is needed to access |
| 25 | # -- relationships, which is where hyperlinks live. |
| 26 | |
| 27 | def __init__( |
| 28 | self, |
| 29 | xPr: CT_NonVisualDrawingProps | CT_TextCharacterProperties, |
| 30 | parent: BaseShape, |
| 31 | hover: bool = False, |
| 32 | ): |
| 33 | super(ActionSetting, self).__init__(parent) |
| 34 | # xPr is either a cNvPr or rPr element |
| 35 | self._element = xPr |
| 36 | # _hover determines use of `a:hlinkClick` or `a:hlinkHover` |
| 37 | self._hover = hover |
| 38 | |
| 39 | @property |
| 40 | def action(self): |
| 41 | """Member of :ref:`PpActionType` enumeration, such as `PP_ACTION.HYPERLINK`. |
| 42 | |
| 43 | The returned member indicates the type of action that will result when the |
| 44 | specified shape or text is clicked or the mouse pointer is positioned over the |
| 45 | shape during a slide show. |
| 46 | |
| 47 | If there is no click-action or the click-action value is not recognized (is not |
| 48 | one of the official `MsoPpAction` values) then `PP_ACTION.NONE` is returned. |
| 49 | """ |
| 50 | hlink = self._hlink |
| 51 | |
| 52 | if hlink is None: |
| 53 | return PP_ACTION.NONE |
| 54 | |
| 55 | action_verb = hlink.action_verb |
| 56 | |
| 57 | if action_verb == "hlinkshowjump": |
| 58 | relative_target = hlink.action_fields["jump"] |
| 59 | return { |
| 60 | "firstslide": PP_ACTION.FIRST_SLIDE, |
| 61 | "lastslide": PP_ACTION.LAST_SLIDE, |
| 62 | "lastslideviewed": PP_ACTION.LAST_SLIDE_VIEWED, |
| 63 | "nextslide": PP_ACTION.NEXT_SLIDE, |
| 64 | "previousslide": PP_ACTION.PREVIOUS_SLIDE, |
| 65 | "endshow": PP_ACTION.END_SHOW, |
| 66 | }[relative_target] |
| 67 | |
| 68 | return { |
| 69 | None: PP_ACTION.HYPERLINK, |
| 70 | "hlinksldjump": PP_ACTION.NAMED_SLIDE, |
| 71 | "hlinkpres": PP_ACTION.PLAY, |
| 72 | "hlinkfile": PP_ACTION.OPEN_FILE, |
| 73 | "customshow": PP_ACTION.NAMED_SLIDE_SHOW, |
| 74 | "ole": PP_ACTION.OLE_VERB, |
| 75 | "macro": PP_ACTION.RUN_MACRO, |
| 76 | "program": PP_ACTION.RUN_PROGRAM, |
| 77 | }.get(action_verb, PP_ACTION.NONE) |
| 78 |
no outgoing calls
searching dependent graphs…