Example #1
0
 public DocumentFill(DocumentDeserializationContext context, PropertyDictionary framedObjectDictionary)
 {
     if (framedObjectDictionary.HasDictionaryFor("color"))
     {
         _color = PropertyBuilders.ToColor(framedObjectDictionary.DictionaryFor("color"));
     }
 }
Example #2
0
        public DocumentFrame(DocumentDeserializationContext context, PropertyDictionary frameProperties)
        {
            if (!frameProperties.HasDictionaryFor("offsetInDocument"))
            {
                throw new DocumentReadingException("A frame is missing the required \"offsetInDocument\" field.");
            }

            _offsetInDocument = PropertyBuilders.ToPoint(frameProperties.DictionaryFor("offsetInDocument"));
        }
        public LabelDocumentFrame(DocumentDeserializationContext context, PropertyDictionary frameProperties)
            : base(context, frameProperties)
        {
            if (!frameProperties.HasDictionaryFor("callOutOffsetInDocument"))
            {
                throw new DocumentReadingException("A label frame is missing the required \"callOutOffsetInDocument\" field.");
            }

            _callOutOffsetInDocument = PropertyBuilders.ToSize(frameProperties.DictionaryFor("callOutOffsetInDocument"));
            _label = frameProperties.StringFor("label", "");
            _caption = frameProperties.StringFor("caption", "");
        }
        public RectangularDocumentFrame(DocumentDeserializationContext context, PropertyDictionary frameDictionary)
            : base(context, frameDictionary)
        {
            if (!frameDictionary.HasDictionaryFor("clipBounds"))
            {
                throw new DocumentReadingException("A label frame is missing the required \"clipBounds\" field.");
            }

            if (!frameDictionary.HasDictionaryFor("framedObject"))
            {
                throw new DocumentReadingException("A label frame is missing the required \"framedObject\" field.");
            }

            _clipBounds = PropertyBuilders.ToRectangle(frameDictionary.DictionaryFor("clipBounds"));

            PropertyDictionary framedObjectDictionary = frameDictionary.DictionaryFor("framedObject");

            string framedObjectType = framedObjectDictionary.StringFor("type", "missing");

            switch (framedObjectType)
            {
                case "image":
                    _framedObject = new DocumentImage(context, framedObjectDictionary);
                    break;

                case "fill":
                    _framedObject = new DocumentFill(context, framedObjectDictionary);
                    break;

                default:
                    throw new DocumentReadingException(string.Format("The document object type \"{0}\" is not supported in this version.",
                        framedObjectType));
            }
        }