Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup of #12861: custom annotations in Word break annotations in elem… #13149

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions source/NVDAObjects/UIA/wordDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def getCommentInfoFromPosition(position):
UIAElement=UIAElement.buildUpdatedCache(UIAHandler.handler.baseCacheRequest)
typeID = UIAElement.GetCurrentPropertyValue(UIAHandler.UIA_AnnotationAnnotationTypeIdPropertyId)
# Use Annotation Type Comment if available
cats = position.obj._UIACustomAnnotationTypes
obj = UIA(UIAElement=UIAElement)
cats = obj._UIACustomAnnotationTypes
if (
typeID == UIAHandler.AnnotationType_Comment
or (typeID and typeID == cats.microsoftWord_draftComment)
Expand All @@ -102,25 +103,23 @@ def getCommentInfoFromPosition(position):
author = UIAElement.GetCurrentPropertyValue(UIAHandler.UIA_AnnotationAuthorPropertyId)
date = UIAElement.GetCurrentPropertyValue(UIAHandler.UIA_AnnotationDateTimePropertyId)
return dict(comment=comment, author=author, date=date)
else:
obj = UIA(UIAElement=UIAElement)
if (
not obj.parent
# Because the name of this object is language sensetive check if it has UIA Annotation Pattern
or not obj.parent.UIAElement.getCurrentPropertyValue(
UIAHandler.UIA_IsAnnotationPatternAvailablePropertyId
)
):
continue
comment = obj.makeTextInfo(textInfos.POSITION_ALL).text
tempObj = obj.previous.previous
authorObj = tempObj or obj.previous
author = authorObj.name
if not tempObj:
return dict(comment=comment, author=author)
dateObj = obj.previous
date = dateObj.name
return dict(comment=comment, author=author, date=date)
elif (
not obj.parent
# Because the name of this object is language sensetive check if it has UIA Annotation Pattern
or not obj.parent.UIAElement.getCurrentPropertyValue(
UIAHandler.UIA_IsAnnotationPatternAvailablePropertyId
)
):
continue
comment = obj.makeTextInfo(textInfos.POSITION_ALL).text
tempObj = obj.previous.previous
authorObj = tempObj or obj.previous
author = authorObj.name
if not tempObj:
return dict(comment=comment, author=author)
dateObj = obj.previous
date = dateObj.name
return dict(comment=comment, author=author, date=date)


def getPresentableCommentInfoFromPosition(commentInfo):
Expand Down