internal override sealed bool AddOptionCallback(PrintCapabilityOption baseOption)
        {
            FixedMediaSizeOption option = baseOption as FixedMediaSizeOption;
            bool complete = false;

            // All PageMediaSize options must have an option name
            if (option._optionName == null)
            {
                return(complete);
            }

            int enumValue = PrintSchemaMapper.SchemaNameToEnumValueWithArray(
                PrintSchemaTags.Keywords.PageMediaSizeKeys.MediaSizeNames,
                PrintSchemaTags.Keywords.PageMediaSizeKeys.MediaSizeEnums,
                option._optionName);

            // We only support standard Print Schema options
            if (enumValue > 0)
            {
                option._value = (PageMediaSizeName)enumValue;
                if ((option._mediaSizeWidth > 0) ||
                    (option._mediaSizeHeight > 0))
                {
                    this.FixedMediaSizes.Add(option);
                    complete = true;
                }
            }

            return(complete);
        }
        /// <exception cref="XmlException">XML is not well-formed.</exception>
        internal override sealed bool OptionPropCallback(PrintCapabilityOption baseOption, XmlPrintCapReader reader)
        {
            FixedMediaSizeOption option = baseOption as FixedMediaSizeOption;
            bool handled = false;

            if (reader.CurrentElementNodeType == PrintSchemaNodeTypes.ScoredProperty)
            {
                handled = true;

                string sPropertyName = reader.CurrentElementNameAttrValue;

                if ((sPropertyName == PrintSchemaTags.Keywords.PageMediaSizeKeys.MediaSizeWidth) ||
                    (sPropertyName == PrintSchemaTags.Keywords.PageMediaSizeKeys.MediaSizeHeight))
                {
                    if (reader.MoveToNextSchemaElement(reader.CurrentElementDepth + 1,
                                                       PrintSchemaNodeTypes.ScoredPropertyLevelTypes))
                    {
                        if (reader.CurrentElementNodeType == PrintSchemaNodeTypes.Value)
                        {
                            // Child property is Value for fixed media size
                            int  intValue  = 0;
                            bool convertOK = false;

                            try
                            {
                                intValue  = XmlConvertHelper.ConvertStringToInt32(reader.CurrentElementTextValue);
                                convertOK = true;
                            }
                            // We want to catch internal FormatException to skip recoverable XML content syntax error
                            #pragma warning suppress 56502
                            #if _DEBUG
                            catch (FormatException e)
                            #else
                            catch (FormatException)
                            #endif
                            {
                                #if _DEBUG
                                Trace.WriteLine("-Error- Invalid int value '" +
                                                reader.CurrentElementTextValue +
                                                "' at line number " + reader._xmlReader.LineNumber +
                                                ", line position " + reader._xmlReader.LinePosition +
                                                ": " + e.Message);
                                #endif
                            }

                            if (convertOK)
                            {
                                if (sPropertyName == PrintSchemaTags.Keywords.PageMediaSizeKeys.MediaSizeWidth)
                                {
                                    option._mediaSizeWidth = intValue;
                                }
                                else
                                {
                                    option._mediaSizeHeight = intValue;
                                }
                            }
                        }
                    }
                    else
                    {
                        #if _DEBUG
                        Trace.WriteLine("-Error- Missing required Value or ParameterRef child-element at line number " +
                                        reader._xmlReader.LineNumber + ", line position " +
                                        reader._xmlReader.LinePosition);
                        #endif
                    }
                }
                else
                {
                    handled = false;

                    #if _DEBUG
                    Trace.WriteLine("-Warning- skip unknown ScoredProperty '" +
                                    reader.CurrentElementNameAttrValue + "' at line " +
                                    reader._xmlReader.LineNumber + ", position " +
                                    reader._xmlReader.LinePosition);
                    #endif
                }
            }

            return(handled);
        }
        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature)
        {
            FixedMediaSizeOption option = new FixedMediaSizeOption(baseFeature);

            return(option);
        }