Exemplo n.º 1
0
        internal ScalingOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
        {
            _value = PageScaling.Unspecified;

            // We use negative index value to indicate that the custom option's
            // ParameterRef element hasn't been parsed and accepted yet.

            _scaleWIndex = _scaleHIndex = _squareScaleIndex = -1;
        }
Exemplo n.º 2
0
 internal MediaTypeOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
 internal override sealed bool FeaturePropCallback(PrintCapabilityFeature feature, XmlPrintCapReader reader)
 {
     // no feature property to handle
     return(false);
 }
 internal NUpOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _pagesPerSheet = PrintSchema.UnspecifiedIntValue;
 }
 internal override sealed void AddSubFeatureCallback(PrintCapabilityFeature subFeature)
 {
     _presentationDirectionCap = subFeature as NUpPresentationDirectionCapability;
 }
        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature)
        {
            FixedMediaSizeOption option = new FixedMediaSizeOption(baseFeature);

            return(option);
        }
 internal TrueTypeFontModeOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Builds a single feature instance and populates its state
        /// </summary>
        /// <exception cref="XmlException">XML is not well-formed.</exception>
        private void BuildFeature(InternalPrintCapabilities printCap, PrintCapabilityFeature parentFeature)
        {
            int featureIndex = LookupFeatureIndex(_reader.CurrentElementNameAttrValue,
                                                  (parentFeature != null));

            // Skip if the feature is unknown to us
            if (featureIndex < 0)
            {
                #if _DEBUG
                Trace.WriteLine("-Warning- Skip unknown feature '" +
                                _reader.CurrentElementNameAttrValue + "'");
                #endif

                return;
            }

            // So it's a known standard feature we want to handle

            NewFeatureHandler newFeatureCallback;

            // Get all the callback functions of this feature.

            // None of the callback functions should throw FormatException. Throwing XmlException
            // (from XmlTextReader) is OK.

            LookupFeatureCallbacks(_reader.CurrentElementNameAttrValue,
                                   (parentFeature != null),
                                   out newFeatureCallback);

            // New-feature callback returns a new, empty feature object derived from PrintCapabilityFeature
            PrintCapabilityFeature newFeature = newFeatureCallback(printCap);

            // Reader can handle generic feature element XML attributes
            // _reader.FeatureAttributeGenericHandler(newFeature);

            // We assume there is no feature level non-generic XML attribute that
            // needs us calling into feature-specific callback.

            int optionDepth = _reader.CurrentElementDepth + 1;

            PrintSchemaNodeTypes typeFilterFlags;

            if (newFeature.HasSubFeature)
            {
                typeFilterFlags = PrintSchemaNodeTypes.FeatureLevelTypesWithSubFeature;
            }
            else
            {
                typeFilterFlags = PrintSchemaNodeTypes.FeatureLevelTypesWithoutSubFeature;
            }

            // This "while" loops over immediate children of the feature element
            while (_reader.MoveToNextSchemaElement(optionDepth, typeFilterFlags))
            {
                if (_reader.CurrentElementNodeType == PrintSchemaNodeTypes.Property)
                {
                    // Process feature property
                    bool handled = false;

                    // call feature-specific callback
                    handled = newFeature.FeaturePropCallback(newFeature, _reader);

                    if (!handled)
                    {
                        #if _DEBUG
                        Trace.WriteLine("-Warning- Skip feature's unknown " + _reader.CurrentElementNodeType +
                                        " '" + _reader.CurrentElementNameAttrValue + "'" +
                                        " at line " + _reader._xmlReader.LineNumber +
                                        ", position " + _reader._xmlReader.LinePosition);
                        #endif
                    }
                }
                else if (_reader.CurrentElementNodeType == PrintSchemaNodeTypes.Option)
                {
                    // Process feature option

                    // New-option callback returns a new, empty option object derived from PrintCapabilityOption
                    PrintCapabilityOption newOption = newFeature.NewOptionCallback(newFeature);

                    // Reader can handle generic option element XML attributes
                    _reader.OptionAttributeGenericHandler(newOption);

                    // Specific feature may also have unique XML attributes to process
                    newFeature.OptionAttrCallback(newOption, _reader);

                    // Go one level deeper if the option is non-empty since it could have
                    // properties as sub-elements.
                    if (!_reader.CurrentElementIsEmpty)
                    {
                        int optionPropertyDepth = optionDepth + 1;

                        // This "while" loops over immediate children of the option element
                        while (_reader.MoveToNextSchemaElement(optionPropertyDepth,
                                                               PrintSchemaNodeTypes.OptionLevelTypes))
                        {
                            bool handled = false;

                            // If it's not generic property, use feature-specific callback
                            handled = newFeature.OptionPropCallback(newOption, _reader);

                            if (!handled)
                            {
                                #if _DEBUG
                                Trace.WriteLine("-Warning- Skip option's unknown " + _reader.CurrentElementNodeType +
                                                " at line " + _reader._xmlReader.LineNumber +
                                                ", position " + _reader._xmlReader.LinePosition);
                                #endif
                            }
                        }
                    }

                    // Finished reading and building this option, so add it to the option collection.
                    // The capability-specific AddOption() function will have logic to check
                    // the completeness of the newOption and based on that decide whether or not to
                    // add the option to the option collection.
                    if (!newFeature.AddOptionCallback(newOption))
                    {
                        #if _DEBUG
                        Trace.WriteLine("-Warning- skip unknown or incomplete option (name='" +
                                        newOption._optionName + "') at line " +
                                        _reader._xmlReader.LineNumber + ", position " +
                                        _reader._xmlReader.LinePosition + ": " + newOption);
                        #endif
                    }
                }
                else if (_reader.CurrentElementNodeType == PrintSchemaNodeTypes.Feature)
                {
                    #if _DEBUG
                    Trace.Assert(newFeature.HasSubFeature,
                                 "THIS SHOULD NOT HAPPEN: BuildFeature() hits sub-feature " +
                                 _reader.CurrentElementNameAttrValue);
                    #endif

                    // Recursively builds the sub-feature
                    BuildFeature(printCap, newFeature);
                }
                else
                {
                    #if _DEBUG
                    Trace.Assert(false, "THIS SHOULD NOT HAPPEN: BuildFeature() hits " +
                                 _reader.CurrentElementNodeType + " node " +
                                 _reader.CurrentElementNameAttrValue);
                    #endif
                }
            }

            // Accept the new feature only if it has valid state
            if (newFeature.IsValid)
            {
                if (parentFeature != null)
                {
                    parentFeature.AddSubFeatureCallback(newFeature);
                }
                else
                {
                    printCap._pcRootFeatures[featureIndex] = newFeature;
                }
            }
            else
            {
                #if _DEBUG
                Trace.WriteLine("-Warning- skip invalid or incomplete feature " + newFeature.FeatureName);
                #endif
            }
        }
 internal ResolutionOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _resolutionX  = _resolutionY = PrintSchema.UnspecifiedIntValue;
     _qualityValue = 0;
 }
 internal BorderlessOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature)
        {
            BorderlessOption option = new BorderlessOption(baseFeature);

            return(option);
        }
Exemplo n.º 12
0
 internal OutputColorOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
Exemplo n.º 13
0
        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature)
        {
            OutputColorOption option = new OutputColorOption(baseFeature);

            return(option);
        }
Exemplo n.º 14
0
 internal PhotoPrintingIntentOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
Exemplo n.º 15
0
        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature)
        {
            PhotoPrintingIntentOption option = new PhotoPrintingIntentOption(baseFeature);

            return(option);
        }
Exemplo n.º 16
0
        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature)
        {
            DuplexOption option = new DuplexOption(baseFeature);

            return(option);
        }
Exemplo n.º 17
0
 internal DuplexOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature)
        {
            DeviceFontSubstitutionOption option = new DeviceFontSubstitutionOption(baseFeature);

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

            return(option);
        }
 internal DeviceFontSubstitutionOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
 internal override sealed void AddSubFeatureCallback(PrintCapabilityFeature subFeature)
 {
     // PageMediaSize has no sub features.
     return;
 }
 internal OrientationOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
 internal FixedMediaSizeOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value          = 0;
     _mediaSizeWidth = _mediaSizeHeight = PrintSchema.UnspecifiedIntValue;
 }
Exemplo n.º 24
0
 internal PageOrderOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
Exemplo n.º 25
0
 internal NUpPresentationDirectionOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
Exemplo n.º 26
0
 internal CollateOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }
Exemplo n.º 27
0
 internal override sealed void AddSubFeatureCallback(PrintCapabilityFeature subFeature)
 {
     // no sub-feature
     return;
 }
Exemplo n.º 28
0
        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature)
        {
            ScalingOption newOption = new ScalingOption(baseFeature);

            return(newOption);
        }
Exemplo n.º 29
0
        internal override sealed PrintCapabilityOption NewOptionCallback(PrintCapabilityFeature baseFeature)
        {
            NUpPresentationDirectionOption option = new NUpPresentationDirectionOption(baseFeature);

            return(option);
        }
Exemplo n.º 30
0
 internal StaplingOption(PrintCapabilityFeature ownerFeature) : base(ownerFeature)
 {
     _value = 0;
 }