/// <summary>
        /// Init
        /// </summary>
        /// <param name="cAttributes">length of aAttributes</param>
        /// <param name="aAttributes">array of FULLPROPSPEC structs</param>
        /// <returns>managed array</returns>
        internal static ManagedFullPropSpec[] MarshalFullPropSpecArray(
            uint cAttributes,    // length of aAttributes
            FULLPROPSPEC[] aAttributes) 
        {
            // If there are attributes, these override the flags
            if (cAttributes > 0)
            {
                // Attributes count and array should match.
                // This has already been checked for by XpsFilter.
                Invariant.Assert(aAttributes != null);

                ManagedFullPropSpec[] initAttributes = new ManagedFullPropSpec[checked((int)cAttributes)];

                // convert to managed equivalents to isolate the marshaling effort
                for (int i = 0; i < cAttributes; i++)
                {
                    // convert and add to local list
                    initAttributes[i] = new ManagedFullPropSpec(aAttributes[i]);
                }

                return initAttributes;
            }
            else
                return null;
        }
        /// <summary>
        /// Init
        /// </summary>
        /// <param name="cAttributes">length of aAttributes</param>
        /// <param name="aAttributes">array of FULLPROPSPEC structs</param>
        /// <returns>managed array</returns>
        internal static ManagedFullPropSpec[] MarshalFullPropSpecArray(
            uint cAttributes,    // length of aAttributes
            FULLPROPSPEC[] aAttributes)
        {
            // If there are attributes, these override the flags
            if (cAttributes > 0)
            {
                // Attributes count and array should match.
                // This has already been checked for by XpsFilter.
                Invariant.Assert(aAttributes != null);

                ManagedFullPropSpec[] initAttributes = new ManagedFullPropSpec[checked ((int)cAttributes)];

                // convert to managed equivalents to isolate the marshaling effort
                for (int i = 0; i < cAttributes; i++)
                {
                    // convert and add to local list
                    initAttributes[i] = new ManagedFullPropSpec(aAttributes[i]);
                }

                return(initAttributes);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="coreProperties">CoreProperties to enumerate</param>
        /// <param name="grfFlags">
        /// if IFILTER_INIT_APPLY_INDEX_ATTRIBUTES is specified,
        /// this indicates all core properties to be returned unless
        /// the parameter aAttributes is non-empty.
        /// </param>
        /// <param name="attributes">
        /// attributes specified corresponding to the properties to filter.
        /// </param>
        internal CorePropertyEnumerator(PackageProperties coreProperties,
                                        IFILTER_INIT grfFlags,
                                        ManagedFullPropSpec[] attributes)
        {
            if (attributes != null && attributes.Length > 0)
            {
                //
                // If attruibutes list specified,
                // return core properties for only those attributes.
                //

                _attributes = attributes;
            }
            else if ((grfFlags & IFILTER_INIT.IFILTER_INIT_APPLY_INDEX_ATTRIBUTES)
                     == IFILTER_INIT.IFILTER_INIT_APPLY_INDEX_ATTRIBUTES)
            {
                //
                // If no attributes list specified,
                // but IFILTER_INIT_APPLY_INDEX_ATTRIBUTES is present in grfFlags,
                // return all core properties.
                //

                _attributes = new ManagedFullPropSpec[]
                {
                    //
                    // SummaryInformation
                    //
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Title),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Subject),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Creator),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Keywords),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Description),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.LastModifiedBy),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Revision),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.LastPrinted),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.DateCreated),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.DateModified),

                    //
                    // DocumentSummaryInformation
                    //
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Category),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Identifier),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.ContentType),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Language),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Version),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.ContentStatus)
                };
            }
            else
            {
                // No core properties to be returned.
            }

            _coreProperties = coreProperties;
            _currentIndex   = -1;
        }
 ///<summary>Build a contents chunk, passing the contents string and specifying whether it comes from a Glyphs element.</summary> 
 ///<param name="contents">The value of the chunk's contents property.</param> 
 ///<param name="chunkID">An arbitrary Uint32 to identify each chunk returned by IFilter.GetChunk.</param>
 ///<param name="breakType">The opening break for the chunk.</param> 
 ///<param name="attribute">A description of the property represented by the chunk.</param>
 ///<param name="lcid">The locale ID for the chunk.</param>
 internal IndexingContentUnit(
     string contents, 
     uint chunkID,
     CHUNK_BREAKTYPE breakType, 
     ManagedFullPropSpec attribute, 
     uint lcid)
     : base(chunkID, breakType, attribute, lcid, CHUNKSTATE.CHUNK_TEXT) 
 {
     _contents = contents;
 }
Beispiel #5
0
 ///<summary>Build a contents chunk, passing the contents string and specifying whether it comes from a Glyphs element.</summary>
 ///<param name="contents">The value of the chunk's contents property.</param>
 ///<param name="chunkID">An arbitrary Uint32 to identify each chunk returned by IFilter.GetChunk.</param>
 ///<param name="breakType">The opening break for the chunk.</param>
 ///<param name="attribute">A description of the property represented by the chunk.</param>
 ///<param name="lcid">The locale ID for the chunk.</param>
 internal IndexingContentUnit(
     string contents,
     uint chunkID,
     CHUNK_BREAKTYPE breakType,
     ManagedFullPropSpec attribute,
     uint lcid)
     : base(chunkID, breakType, attribute, lcid, CHUNKSTATE.CHUNK_TEXT)
 {
     _contents = contents;
 }
 // Token: 0x06006C67 RID: 27751 RVA: 0x001F38FC File Offset: 0x001F1AFC
 internal ManagedChunk(uint index, CHUNK_BREAKTYPE breakType, ManagedFullPropSpec attribute, uint lcid, CHUNKSTATE flags)
 {
     Invariant.Assert(breakType >= CHUNK_BREAKTYPE.CHUNK_NO_BREAK && breakType <= CHUNK_BREAKTYPE.CHUNK_EOC);
     Invariant.Assert(attribute != null);
     this._index         = index;
     this._breakType     = breakType;
     this._lcid          = lcid;
     this._attribute     = attribute;
     this._flags         = flags;
     this._idChunkSource = this._index;
 }
 /// <summary>
 /// A utility to be used when one wants to reuse 
 /// one object to hold different values in succession. 
 /// </summary>
 internal void InitIndexingContentUnit( 
     string contents,
     uint chunkID,
     CHUNK_BREAKTYPE breakType,
     ManagedFullPropSpec attribute, 
     uint lcid)
 { 
     _contents = contents; 
     ID = chunkID;
     BreakType = breakType; 
     Attribute = attribute;
     Locale = lcid;
 }
Beispiel #8
0
 /// <summary>
 /// A utility to be used when one wants to reuse
 /// one object to hold different values in succession.
 /// </summary>
 internal void InitIndexingContentUnit(
     string contents,
     uint chunkID,
     CHUNK_BREAKTYPE breakType,
     ManagedFullPropSpec attribute,
     uint lcid)
 {
     _contents = contents;
     ID        = chunkID;
     BreakType = breakType;
     Attribute = attribute;
     Locale    = lcid;
 }
        /// <summary>
        /// Initialzes the session for this filter.
        /// </summary>
        /// <param name="grfFlags">usage flags</param>
        /// <param name="aAttributes">array of Managed FULLPROPSPEC structs to restrict responses</param>
        /// <returns>IFILTER_FLAGS_NONE. Return value is effectively ignored by the caller.</returns>
        public IFILTER_FLAGS Init(IFILTER_INIT grfFlags, ManagedFullPropSpec[] aAttributes)
        {
            // NOTE: Methods parameters have already been validated by XpsFilter.

            _grfFlags = grfFlags;
            _aAttributes = aAttributes;

            // Each call to Init() creates a new enumerator
            // with parameters corresponding to current Init() call.
            _corePropertyEnumerator = new CorePropertyEnumerator(
                _coreProperties, _grfFlags, _aAttributes);

            return IFILTER_FLAGS.IFILTER_FLAGS_NONE;
        }
 // Token: 0x06006C2E RID: 27694 RVA: 0x001F1CEC File Offset: 0x001EFEEC
 internal static ManagedFullPropSpec[] MarshalFullPropSpecArray(uint cAttributes, FULLPROPSPEC[] aAttributes)
 {
     if (cAttributes > 0U)
     {
         Invariant.Assert(aAttributes != null);
         ManagedFullPropSpec[] array = new ManagedFullPropSpec[checked ((int)cAttributes)];
         int num = 0;
         while ((long)num < (long)((ulong)cAttributes))
         {
             array[num] = new ManagedFullPropSpec(aAttributes[num]);
             num++;
         }
         return(array);
     }
     return(null);
 }
Beispiel #11
0
        ///<summary>Build a contents chunk, passing the contents string.</summary>
        /// <param name="index">id</param>
        /// <param name="breakType">The opening break for the chunk.</param>
        /// <param name="attribute">attribute</param>
        /// <param name="lcid">The locale ID for the chunk.</param>
        /// <param name="flags">Indicates if it is text or value chunk.</param>
        /// <remarks>
        /// All the chunks returned by the XAML filter and the container filter are text chunks.
        /// Should a future filter implementation be capable of returning value chunks, a new constructor
        /// and a Flags property will have to be defined.
        /// </remarks>
        internal ManagedChunk(uint index, CHUNK_BREAKTYPE breakType, ManagedFullPropSpec attribute, uint lcid, CHUNKSTATE flags)
        {
            // Argument errors can only be due to internal inconsistencies, since no input data makes its way here.
            Invariant.Assert(breakType >= CHUNK_BREAKTYPE.CHUNK_NO_BREAK && breakType <= CHUNK_BREAKTYPE.CHUNK_EOC);
            Invariant.Assert(attribute != null);
            // Note that lcid values potentially cover the full range of uint values
            // (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_8sj7.asp)
            // and so no useful validation can be made for lcid.

            _index     = index;
            _breakType = breakType;
            _lcid      = lcid;
            _attribute = attribute;
            _flags     = flags;

            // Since pseudo-properties (a.k.a. internal values) are not supported by the XPS filters,
            // all chunks we return are expected to have idChunkSource equal to idChunk.
            // (See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/indexsrv/html/ixufilt_8ib8.asp)
            _idChunkSource = _index;
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="coreProperties">CoreProperties to enumerate</param>
        /// <param name="grfFlags">
        /// if IFILTER_INIT_APPLY_INDEX_ATTRIBUTES is specified,
        /// this indicates all core properties to be returned unless
        /// the parameter aAttributes is non-empty.
        /// </param>
        /// <param name="attributes">
        /// attributes specified corresponding to the properties to filter.
        /// </param>
        internal CorePropertyEnumerator(PackageProperties coreProperties,
            IFILTER_INIT grfFlags,
            ManagedFullPropSpec[] attributes)
        {
            if (attributes != null && attributes.Length > 0)
            {
                //
                // If attruibutes list specified,
                // return core properties for only those attributes.
                //

                _attributes = attributes;
            }
            else if ((grfFlags & IFILTER_INIT.IFILTER_INIT_APPLY_INDEX_ATTRIBUTES)
                == IFILTER_INIT.IFILTER_INIT_APPLY_INDEX_ATTRIBUTES)
            {
                //
                // If no attributes list specified,
                // but IFILTER_INIT_APPLY_INDEX_ATTRIBUTES is present in grfFlags,
                // return all core properties.
                //

                _attributes = new ManagedFullPropSpec[]
                {
                    //
                    // SummaryInformation
                    //
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Title),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Subject),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Creator),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Keywords),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Description),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.LastModifiedBy),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Revision),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.LastPrinted),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.DateCreated),
                    new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.DateModified),

                    //
                    // DocumentSummaryInformation
                    //
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Category),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Identifier),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.ContentType),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Language),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Version),
                    new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.ContentStatus)
                };
            }
            else
            {
                // No core properties to be returned.
            }

            _coreProperties = coreProperties;
            _currentIndex = -1;
        }
 internal static void MarshalFullPropSpec(ManagedFullPropSpec fullPropSpec, ref FULLPROPSPEC native)
 {
     native.guid = fullPropSpec.Guid;
     MarshalPropSpec(fullPropSpec.Property, ref native.property);
 }
 /// <summary>
 /// Marshal Managed to Native FULLPROPSPEC
 /// </summary>
 /// <param name="fullPropSpec"></param>
 /// <param name="native"></param>
 internal static void MarshalFullPropSpec(ManagedFullPropSpec fullPropSpec, ref FULLPROPSPEC native)
 {
     native.guid = fullPropSpec.Guid;
     MarshalPropSpec(fullPropSpec.Property, ref native.property);
 }
Beispiel #15
0
        ///<summary>Build a contents chunk, passing the contents string.</summary> 
        /// <param name="index">id</param>
        /// <param name="breakType">The opening break for the chunk.</param> 
        /// <param name="attribute">attribute</param>
        /// <param name="lcid">The locale ID for the chunk.</param>
        /// <param name="flags">Indicates if it is text or value chunk.</param>
        /// <remarks> 
        /// All the chunks returned by the XAML filter and the container filter are text chunks.
        /// Should a future filter implementation be capable of returning value chunks, a new constructor 
        /// and a Flags property will have to be defined. 
        /// </remarks>
        internal ManagedChunk(uint index, CHUNK_BREAKTYPE breakType, ManagedFullPropSpec attribute, uint lcid, CHUNKSTATE flags) 
        {
            // Argument errors can only be due to internal inconsistencies, since no input data makes its way here.
            Invariant.Assert(breakType >= CHUNK_BREAKTYPE.CHUNK_NO_BREAK && breakType <= CHUNK_BREAKTYPE.CHUNK_EOC);
            Invariant.Assert(attribute != null); 
            // Note that lcid values potentially cover the full range of uint values
            // (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_8sj7.asp) 
            // and so no useful validation can be made for lcid. 

            _index = index; 
            _breakType = breakType;
            _lcid = lcid;
            _attribute = attribute;
            _flags = flags; 

            // Since pseudo-properties (a.k.a. internal values) are not supported by the XPS filters, 
            // all chunks we return are expected to have idChunkSource equal to idChunk. 
            // (See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/indexsrv/html/ixufilt_8ib8.asp)
            _idChunkSource = _index; 

        }
Beispiel #16
0
        /// <summary>
        /// Managed counterpart of IFilter.Init. 
        /// </summary>
        /// <param name="grfFlags">Usage flags. Only IFILTER_INIT_CANON_PARAGRAPHS can be meaningfully 
        /// honored by the XAML filter.</param> 
        /// <param name="aAttributes">array of Managed FULLPROPSPEC structs to restrict responses</param>
        /// <returns>IFILTER_FLAGS_NONE, meaning the caller should not try to retrieve OLE property using 
        /// IPropertyStorage on the Xaml part.</returns>
        /// <remarks>Input parameters are ignored because this filter never returns any property value.</remarks>
        public IFILTER_FLAGS Init(
            IFILTER_INIT grfFlags,    // IFILTER_INIT value 
            ManagedFullPropSpec[] aAttributes)    // restrict responses to the specified attributes
        { 
            // 
            // Content is filtered either if no attributes are specified,
            // or if there are attributes specified, the attribute with PSGUID_STORAGE 
            // property set and PID_STG_CONTENTS property id is present.
            //

            _filterContents = true; 

            if (aAttributes != null && aAttributes.Length > 0) 
            { 
                _filterContents = false;
 
                for (int i = 0; i < aAttributes.Length; i++)
                {
                    if (aAttributes[i].Guid == IndexingFilterMarshaler.PSGUID_STORAGE
                        && aAttributes[i].Property.PropType == PropSpecType.Id 
                        && aAttributes[i].Property.PropId == (uint)MS.Internal.Interop.PID_STG.CONTENTS)
                    { 
                        _filterContents = true; 
                        break;
                    } 
                }
            }

            // The only flag in grfFlags that makes sense to honor is IFILTER_INIT_CANON_PARAGRAPHS 
            _returnCanonicalParagraphBreaks =
                ((grfFlags & IFILTER_INIT.IFILTER_INIT_CANON_PARAGRAPHS) != 0); 
 
            // Return zero value to indicate that the client code should not take any special steps
            // to retrieve OLE properties. This might have to change if filtering loose Xaml is supported. 
            return IFILTER_FLAGS.IFILTER_FLAGS_NONE;
        }