private void RemoveHighlight_Internal(PDFHighlight highlight)
        {
            int count_before = highlights.Count;

            HashSet <PDFHighlight> highlights_for_page;

            if (highlights.TryGetValue(highlight.Page, out highlights_for_page))
            {
                highlights_for_page.Remove(highlight);
                if (0 == highlights_for_page.Count)
                {
                    highlights.Remove(highlight.Page);
                }
            }

            // If we find we have removed the last highlight, then let's add a null highlight so that the sync happens...
            // This is a hack, so if you can improve the sync problem (don't want to create a lot of null files upfront), then pls do...
            int count_after = highlights.Count;

            if (0 == count_after && 0 != count_before)
            {
                AddHighlight_Internal(new PDFHighlight(1, new Word {
                    Text = ""
                }, 1));
            }
        }
        private void AddHighlight_Internal(PDFHighlight highlight)
        {
            HashSet <PDFHighlight> highlights_for_page;

            if (!highlights.TryGetValue(highlight.Page, out highlights_for_page))
            {
                highlights_for_page        = new HashSet <PDFHighlight>();
                highlights[highlight.Page] = highlights_for_page;
            }

            highlights_for_page.Add(highlight);
        }
Ejemplo n.º 3
0
        public override bool Equals(object obj)
        {
            PDFHighlight other = obj as PDFHighlight;

            if (null == other)
            {
                return(false);
            }

            return(true &&
                   Page == other.Page &&
                   Left == other.Left &&
                   Top == other.Top &&
                   Width == other.Width &&
                   Height == other.Height
                   );
        }
        public void RemoveUpdatedHighlight(PDFHighlight highlight)
        {
            RemoveHighlight_Internal(highlight);

            OnPDFHighlightListChanged?.Invoke();
        }
        public void AddUpdatedHighlight(PDFHighlight highlight)
        {
            AddHighlight_Internal(highlight);

            OnPDFHighlightListChanged?.Invoke();
        }
Ejemplo n.º 6
0
 public void RemoveUpdatedHighlight(PDFHighlight highlight)
 {
     RemoveHighlight_Internal(highlight);
 }
Ejemplo n.º 7
0
 public void AddUpdatedHighlight(PDFHighlight highlight)
 {
     AddHighlight_Internal(highlight);
 }