Beispiel #1
0
        public Bookmark GetBookmark(int index)
        {
            GenericPropertyNode first = bookmarksTables
                                        .GetDescriptorFirst(index);

            return(GetBookmark(first));
        }
Beispiel #2
0
 public Shape(GenericPropertyNode nodo)
 {
     byte[] contenuto = nodo.Bytes;
     _id     = LittleEndian.GetInt(contenuto);
     _left   = LittleEndian.GetInt(contenuto, 4);
     _top    = LittleEndian.GetInt(contenuto, 8);
     _right  = LittleEndian.GetInt(contenuto, 12);
     _bottom = LittleEndian.GetInt(contenuto, 16);
     _inDoc  = (_left >= 0 && _right >= 0 && _top >= 0 && _bottom >=
                0);
 }
Beispiel #3
0
        /**
         * Get the string that's pointed to by the
         *  given plcfHdd index
         */
        private String GetAt(int plcfHddIndex)
        {
            if (plcfHdd == null)
            {
                return(null);
            }

            GenericPropertyNode prop = plcfHdd.GetProperty(plcfHddIndex);

            if (prop.Start == prop.End)
            {
                // Empty story
                return("");
            }
            if (prop.End < prop.Start)
            {
                // Broken properties?
                return("");
            }

            // Ensure we're Getting a sensible length
            String rawText = headerStories.Text;
            int    start   = Math.Min(prop.Start, rawText.Length);
            int    end     = Math.Min(prop.End, rawText.Length);

            // Grab the contents
            String text = rawText.Substring(start, end - start);

            // Strip off fields and macros if requested
            if (stripFields)
            {
                return(Range.StripFields(text));
            }
            // If you create a header/footer, then remove it again, word
            //  will leave \r\r. Turn these back into an empty string,
            //  which is more what you'd expect
            if (text.Equals("\r\r"))
            {
                return("");
            }

            return(text);
        }
Beispiel #4
0
        private void UpdateSortedDescriptors()
        {
            if (sortedDescriptors != null)
            {
                return;
            }

            Dictionary <int, List <GenericPropertyNode> > result = new Dictionary <int, List <GenericPropertyNode> >();

            for (int b = 0; b < bookmarksTables.GetDescriptorsFirstCount(); b++)
            {
                GenericPropertyNode property = bookmarksTables
                                               .GetDescriptorFirst(b);
                int positionKey = property.Start;
                List <GenericPropertyNode> atPositionList = result[positionKey];
                if (atPositionList == null)
                {
                    atPositionList      = new List <GenericPropertyNode>();
                    result[positionKey] = atPositionList;
                }
                atPositionList.Add(property);
            }

            int counter = 0;

            int[] indices = new int[result.Count];
            foreach (KeyValuePair <int, List <GenericPropertyNode> > entry in result)
            {
                indices[counter++] = entry.Key;
                List <GenericPropertyNode> updated = new List <GenericPropertyNode>(
                    entry.Value);
                updated.Sort((IComparer <GenericPropertyNode>)PropertyNode.EndComparator.instance);
                result[entry.Key] = updated;
            }
            Array.Sort(indices);

            this.sortedDescriptors    = result;
            this.sortedStartPositions = indices;
        }
Beispiel #5
0
 private Bookmark GetBookmark(GenericPropertyNode first)
 {
     return(new BookmarkImpl(this.bookmarksTables, first));
 }
Beispiel #6
0
 internal BookmarkImpl(BookmarksTables bookmarksTables, GenericPropertyNode first)
 {
     this.bookmarksTables = bookmarksTables;
     this.first           = first;
 }