Exemple #1
0
        private static TaggingHintKey GetOrCreateHintKey(IPropertyContainer hintOwner, bool setProperty)
        {
            TaggingHintKey hintKey = hintOwner.GetProperty <TaggingHintKey>(Property.TAGGING_HINT_KEY);

            if (hintKey == null)
            {
                IAccessibleElement elem = null;
                if (hintOwner is IAccessibleElement)
                {
                    elem = (IAccessibleElement)hintOwner;
                }
                else
                {
                    if (hintOwner is IRenderer && ((IRenderer)hintOwner).GetModelElement() is IAccessibleElement)
                    {
                        elem = (IAccessibleElement)((IRenderer)hintOwner).GetModelElement();
                    }
                }
                hintKey = new TaggingHintKey(elem, hintOwner is IElement);
                if (elem != null && StandardRoles.ARTIFACT.Equals(elem.GetAccessibilityProperties().GetRole()))
                {
                    hintKey.SetArtifact();
                    hintKey.SetFinished();
                }
                if (setProperty)
                {
                    if (elem is ILargeElement && !((ILargeElement)elem).IsComplete())
                    {
                        ((ILargeElement)elem).SetProperty(Property.TAGGING_HINT_KEY, hintKey);
                    }
                    else
                    {
                        hintOwner.SetProperty(Property.TAGGING_HINT_KEY, hintKey);
                    }
                }
            }
            return(hintKey);
        }
Exemple #2
0
        public virtual void MarkArtifactHint(TaggingHintKey hintKey)
        {
            hintKey.SetArtifact();
            hintKey.SetFinished();
            TagTreePointer existingArtifactTag = new TagTreePointer(document);

            if (context.GetWaitingTagsManager().TryMovePointerToWaitingTag(existingArtifactTag, hintKey))
            {
                ILog logger = LogManager.GetLogger(typeof(iText.Layout.Tagging.LayoutTaggingHelper));
                logger.Error(iText.IO.LogMessageConstant.ALREADY_TAGGED_HINT_MARKED_ARTIFACT);
                context.GetWaitingTagsManager().RemoveWaitingState(hintKey);
                if (immediateFlush)
                {
                    existingArtifactTag.FlushParentsIfAllKidsFlushed();
                }
            }
            IList <TaggingHintKey> kidsHint = GetKidsHint(hintKey);

            foreach (TaggingHintKey kidKey in kidsHint)
            {
                MarkArtifactHint(kidKey);
            }
            RemoveParentHint(hintKey);
        }