Skip to content

Commit

Permalink
PowerPoint appModule: Reintroduce scripts for moving between slides a…
Browse files Browse the repository at this point in the history
…nd shapes, and for changing slides in a running slide show. Make sure that we don't get duplicates due to a script and event both firing. The scripts are necessary as Office 2010's protected mode refuses to fire events. Its also worth noting that certain slide changes such as with an enter press were rather flaky with events anyway. Fixes #3144.
  • Loading branch information
michaelDCurran committed Apr 16, 2013
1 parent 52a4549 commit 55f6698
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions source/appModules/powerpnt.py
Expand Up @@ -250,6 +250,7 @@ def _get_ppObjectModel(self):
self.ppObjectModel=m
return self.ppObjectModel

_cache_currentSlide=False
def _get_currentSlide(self):
try:
ppSlide=self.ppObjectModel.view.slide
Expand Down Expand Up @@ -413,7 +414,7 @@ def handleSelectionChange(self):
obj=self.selection
if not obj:
obj=DocumentWindow(windowHandle=self.windowHandle)
if obj and obj!=api.getFocusObject():
if obj and obj!=api.getFocusObject() and not eventHandler.isPendingEvents("gainFocus"):
eventHandler.queueEvent("gainFocus",obj)

def event_gainFocus(self):
Expand All @@ -430,6 +431,15 @@ def script_selectionChange(self,gesture):
self.handleSelectionChange()
script_selectionChange.canPropagate=True

__gestures={k:"selectionChange" for k in (
"kb:tab","kb:shift+tab",
"kb:leftArrow","kb:rightArrow","kb:upArrow","kb:downArrow",
"kb:shift+leftArrow","kb:shift+rightArrow","kb:shift+upArrow","kb:shift+downArrow",
"kb:pageUp","kb:pageDown",
"kb:home","kb:control+home","kb:end","kb:control+end",
"kb:shift+home","kb:shift+control+home","kb:shift+end","kb:shift+control+end",
)}

class OutlinePane(EditableTextWithoutAutoSelectDetection,PaneClassDC):
TextInfo=EditableTextDisplayModelTextInfo
role=controlTypes.ROLE_EDITABLETEXT
Expand All @@ -456,6 +466,10 @@ def _get_parent(self):
def script_selectionChange(self,gesture):
return self.documentWindow.script_selectionChange(gesture)

__gestures={
"kb:escape":"selectionChange",
}

class SlideBase(PpObject):

presentationType=Window.presType_content
Expand Down Expand Up @@ -556,6 +570,11 @@ def _get_value(self):
if self.ppObject.hasTextFrame:
return self.ppObject.textFrame.textRange.text

__gestures={
"kb:enter":"selectionChange",
"kb:f2":"selectionChange",
}

class TextFrameTextInfo(textInfos.offsets.OffsetsTextInfo):

def _getCaretOffset(self):
Expand Down Expand Up @@ -737,7 +756,16 @@ def script_toggleNotesMode(self,gesture):
# Translators: The description for a script
script_toggleNotesMode.__doc__=_("Toggles between reporting the speaker notes or the actual slide content. This does not change what is visible on-screen, but only what the user can read with NVDA")

def script_slideChange(self,gesture):
gesture.send()
self.rootNVDAObject.handleSlideChange()

__gestures={
"kb:space":"slideChange",
"kb:enter":"slideChange",
"kb:backspace":"slideChange",
"kb:pageUp":"slideChange",
"kb:pageDown":"slideChange",
"kb:control+shift+s":"toggleNotesMode",
}

Expand All @@ -747,6 +775,8 @@ class ReviewableSlideshowTreeInterceptor(ReviewCursorManager,SlideShowTreeInterc

class SlideShowWindow(PaneClassDC):

_lastSlideChangeID=None

treeInterceptorClass=ReviewableSlideshowTreeInterceptor
notesMode=False #: If true then speaker notes will be exposed as this object's basicText, rather than the actual slide content.

Expand Down Expand Up @@ -822,12 +852,15 @@ def _get_basicText(self):
self.basicText=_("Empty slide")
return self.basicText or _("Empty slide")


def handleSlideChange(self):
try:
del self.__dict__['currentSlide']
except KeyError:
pass
curSlideChangeID=self.name
if curSlideChangeID==self._lastSlideChangeID:
return
self._lastSlideChangeID=curSlideChangeID
try:
del self.__dict__['basicText']
except KeyError:
Expand Down

0 comments on commit 55f6698

Please sign in to comment.