/// <summary>
        /// OnNewMark has to be called when a new mark starts.
        /// </summary>
        /// <remarks>
        /// The previous mark is sent to the handler and the properties are initialized with default properties and the mark attributes.
        /// </remarks>
        /// <param name="handler">The Wang annotation handler.</param>
        /// <param name="propertiesCurrent">The current properties.</param>
        /// <param name="stream">The stream to read the data in.</param>
        /// <param name="dataSize">The size of the block.</param>
        /// <param name="propertiesDefault">The default properties.</param>
        /// <returns>true if the operation succeeded otherwise returns false.</returns>
        private static bool OnNewMark(IWangAnnotationHandler handler, WangAnnotationProperties propertiesCurrent,
                                      IWangStream stream, int dataSize, WangAnnotationProperties propertiesDefault)
        {
            if (propertiesCurrent.HasMarkAttributes && !WangAnnotationTranslator.Send(handler, propertiesCurrent))
            {
                return(false);
            }

            propertiesCurrent.CopyFrom(propertiesDefault);

            WangMarkAttributes markAttributes = WangAnnotationStructureReader.ReadMarkAttributes(stream, dataSize);

            if (markAttributes == null)
            {
                return(false);
            }
            propertiesCurrent.SetMarkAttributes(markAttributes);
            return(true);
        }
        /// <summary>
        /// ReadMarkAttributes reads a structure designed to hold mark attributes.
        /// </summary>
        /// <remarks>
        /// This methods aplies when the specifications are mentionning the availability of a OIAN_MARK_ATTRIBUTES structure.
        /// </remarks>
        /// <param name="stream">The stream to read the data in.</param>
        /// <param name="dataSize">The size of the data to read.</param>
        /// <returns>The data read.</returns>
        public static WangMarkAttributes ReadMarkAttributes(IWangStream stream, int dataSize)
        {
            // The expected data size is fixed.
            if (dataSize == 164)
            {
                /*
                 * Type         Name                Description
                 * UINT         uType               The type of the mark.
                 * LRECT        lrBounds            Rectangle in FULLSIZE units; equivalent to type RECT.
                 *                                  Can be a rectangle or two points.
                 * RGBQUAD      rgbColor1           The main color; for example, the color of all lines, all rectangles, and standalone text.
                 * RGBQUAD      rgbColor2           The secondary color; for example, the color of the text of an Attach-a-Note.
                 * BOOL         bHighlighting       TRUE - The mark is drawn highlighted. Highlighting
                 *                                  performs the same function as a highlighting marker on a
                 *                                  piece of paper. Valid only for lines, rectangles, and
                 *                                  freehand.
                 * BOOL         bTransparent        TRUE - The mark is drawn transparent. A transparent
                 *                                  mark does not draw white pixels. That is, transparent
                 *                                  replaces white pixels with whatever is behind those pixels.
                 *                                  Available only for images.
                 * UINT         uLineSize           The width of the line in pixels.
                 * UINT         uReserved1          Reserved; must be set to 0.
                 * UINT         uReserved2          Reserved; must be set to 0.
                 * LOGFONT      lfFont              The font information for the text, consisting of standard
                 *                                  font attributes of font size, name, style, effects, and
                 *                                  background color.
                 * DWORD        bReserved3          Reserved; must be set to 0.
                 * time_t       Time                The time that the mark was first saved, in seconds, from
                 *                                  00:00:00 1-1-1970 GMT. Every annotation mark has
                 *                                  time as one of its attributes. If you do not set the time before
                 *                                  the file is saved, the time is set to the date and time that the
                 *                                  save was initiated. This time is in the form returned by the
                 *                                  "time" C call, which is the number of seconds since
                 *                                  midnight 00:00:00 on 1-1-1970 GMT. If necessary, refer
                 *                                  to your C documentation for a more detailed description.
                 * BOOL         bVisible            TRUE - The mark is currently set to be visible.
                 *                                  Annotation marks can be visible or hidden.
                 * DWORD        dwReserved4         Reserved; must be set to 0x0FF83F.
                 * long         lReserved[10]       Must be set to 0.
                 */

                uint         uintMarkType = stream.ReadUint32();
                WangMarkType type         = uintMarkType < ConversionWangMarkTypes.Length
                    ? ConversionWangMarkTypes[uintMarkType]
                    : WangMarkType.Invalid;
                WangMarkAttributes readData = new WangMarkAttributes(type);

                if (!WangAnnotationStructureReader.ReadRectangle(readData.Bounds, stream))
                {
                    return(null);
                }
                if (!WangAnnotationStructureReader.ReadRgbQuad(readData.Color1, stream))
                {
                    return(null);
                }
                if (!WangAnnotationStructureReader.ReadRgbQuad(readData.Color2, stream))
                {
                    return(null);
                }

                readData.Highlighting = WangAnnotationStructureReader.ReadBool(stream);
                readData.Transparent  = WangAnnotationStructureReader.ReadBool(stream);
                readData.LineSize     = stream.ReadUint32();
                uint uReserved1 = stream.ReadUint32();
#if DEBUG
                // Reserved; must be set to 0.
                Debug.Assert(uReserved1 == 0);
#endif // DEBUG
                uint uReserved2 = stream.ReadUint32();
#if DEBUG
                // Reserved; must be set to 0.
                Debug.Assert(uReserved2 == 0);
#endif // DEBUG
                readData.LogFont = ReadLogfont(stream);

                uint bReserved3 = stream.ReadUint32();
#if DEBUG
                // Reserved; must be set to 0.
                // For some reason several file have a non 0 value there.
                // Debug.Assert(bReserved3 == 0);
#endif // DEBUG
                // Skip time
                // TODO - David Ometto - 2016-11-21 - Add support for reading time_t structure.
                stream.SkipBytes(8);

                readData.Visible = WangAnnotationStructureReader.ReadBool(stream);

                // Reserved; must be set to 0x0FF83F... but for some reason several file have a non 0 value there.
                uint dwReserved4 = stream.ReadUint32();

                // Skip 10 reserved long must be set to 0 (which is not true all of the time).
                stream.SkipBytes(40);

                return(readData);
            }
            else
            {
                return(null);
            }
        }