Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / MS / Internal / Automation / TextProviderWrapper.cs / 1 / TextProviderWrapper.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Text pattern provider wrapper for WCP
//
// History:
// 03/09/2004 : [....] created.
//
//---------------------------------------------------------------------------
using System;
using System.Windows.Threading;
using System.Windows;
using System.Windows.Media;
using System.Windows.Automation;
using System.Windows.Automation.Provider;
using System.Windows.Automation.Text;
using System.Windows.Automation.Peers;
using SR = MS.Internal.PresentationCore.SR;
using SRID = MS.Internal.PresentationCore.SRID;
namespace MS.Internal.Automation
{
// see comment on InvokeProviderWrapper class for explanation of purpose and organization of these wrapper classes.
internal class TextProviderWrapper : MarshalByRefObject, ITextProvider
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
private TextProviderWrapper( AutomationPeer peer, ITextProvider iface )
{
_peer = peer;
_iface = iface;
}
#endregion Constructors
//------------------------------------------------------
//
// Interface ITextProvider
//
//-----------------------------------------------------
#region Interface ITextProvider
public ITextRangeProvider [] GetSelection()
{
return (ITextRangeProvider [])ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetSelection), null);
}
public ITextRangeProvider [] GetVisibleRanges()
{
return (ITextRangeProvider[])ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetVisibleRanges), null);
}
public ITextRangeProvider RangeFromChild(IRawElementProviderSimple childElement)
{
if (!(childElement is ElementProxy))
{
throw new ArgumentException(SR.Get(SRID.TextProvider_InvalidChild, "childElement"));
}
return (ITextRangeProvider)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(RangeFromChild), childElement);
}
public ITextRangeProvider RangeFromPoint(Point screenLocation)
{
return (ITextRangeProvider)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(RangeFromPoint), screenLocation);
}
public ITextRangeProvider DocumentRange
{
get
{
return (ITextRangeProvider)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetDocumentRange), null);
}
}
public SupportedTextSelection SupportedTextSelection
{
get
{
return (SupportedTextSelection)ElementUtil.Invoke(_peer, new DispatcherOperationCallback(GetSupportedTextSelection), null);
}
}
#endregion Interface ITextProvider
//------------------------------------------------------
//
// Internal Methods
//
//------------------------------------------------------
#region Internal Methods
internal static object Wrap( AutomationPeer peer, object iface )
{
return new TextProviderWrapper( peer, (ITextProvider) iface );
}
#endregion Internal Methods
//-----------------------------------------------------
//
// Private Methods
//
//------------------------------------------------------
#region Private Methods
private object GetSelection(object unused)
{
return TextRangeProviderWrapper.WrapArgument( _iface.GetSelection(), _peer );
}
private object GetVisibleRanges(object unused)
{
return TextRangeProviderWrapper.WrapArgument( _iface.GetVisibleRanges(), _peer );
}
private object RangeFromChild(object arg)
{
IRawElementProviderSimple childElement = (IRawElementProviderSimple)arg;
return TextRangeProviderWrapper.WrapArgument( _iface.RangeFromChild(childElement), _peer );
}
private object RangeFromPoint(object arg)
{
Point screenLocation = (Point)arg;
return TextRangeProviderWrapper.WrapArgument( _iface.RangeFromPoint(screenLocation), _peer );
}
private object GetDocumentRange(object unused)
{
return TextRangeProviderWrapper.WrapArgument( _iface.DocumentRange, _peer );
}
private object GetSupportedTextSelection(object unused)
{
return _iface.SupportedTextSelection;
}
#endregion Private Methods
//-----------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
private AutomationPeer _peer;
private ITextProvider _iface;
#endregion Private Fields
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ModuleElement.cs
- nulltextcontainer.cs
- SchemaCollectionPreprocessor.cs
- SqlGatherProducedAliases.cs
- BinarySecretKeyIdentifierClause.cs
- ExecutionScope.cs
- SqlServer2KCompatibilityCheck.cs
- localization.cs
- LiteralLink.cs
- ToolStripMenuItemCodeDomSerializer.cs
- BrowserCapabilitiesFactoryBase.cs
- ImageIndexConverter.cs
- Hash.cs
- IndicCharClassifier.cs
- TextModifier.cs
- EDesignUtil.cs
- PluralizationService.cs
- IndexOutOfRangeException.cs
- ResourceContainer.cs
- ThreadStaticAttribute.cs
- Version.cs
- CollectionBuilder.cs
- ExtendedPropertyInfo.cs
- OracleBoolean.cs
- NumberFunctions.cs
- DisplayNameAttribute.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- Compiler.cs
- UrlMappingsModule.cs
- SafeNativeMethods.cs
- BamlLocalizabilityResolver.cs
- Imaging.cs
- Expression.cs
- DropDownList.cs
- StatusBar.cs
- SwitchLevelAttribute.cs
- DataGridBeginningEditEventArgs.cs
- PointCollectionValueSerializer.cs
- AstTree.cs
- XmlSchemaImport.cs
- XmlWellformedWriter.cs
- Point3DCollection.cs
- ClockController.cs
- HwndMouseInputProvider.cs
- DbConvert.cs
- TemplateApplicationHelper.cs
- Material.cs
- Panel.cs
- ErrorHandlingAcceptor.cs
- ServicePointManagerElement.cs
- Win32Interop.cs
- IndexedWhereQueryOperator.cs
- BufferAllocator.cs
- SerializationAttributes.cs
- ProcessHostFactoryHelper.cs
- SQLResource.cs
- ScriptBehaviorDescriptor.cs
- MdImport.cs
- DataGridHeaderBorder.cs
- MethodExpression.cs
- BasePattern.cs
- DbConnectionStringCommon.cs
- GridViewRowPresenter.cs
- Adorner.cs
- BaseParser.cs
- FacetEnabledSchemaElement.cs
- SqlInfoMessageEvent.cs
- DataShape.cs
- DataObjectSettingDataEventArgs.cs
- FontStretchConverter.cs
- PkcsMisc.cs
- LostFocusEventManager.cs
- Main.cs
- EntitySqlException.cs
- XmlSchemaSimpleContent.cs
- DynamicDocumentPaginator.cs
- ImpersonateTokenRef.cs
- QueryPageSettingsEventArgs.cs
- ReadOnlyObservableCollection.cs
- ContactManager.cs
- SafeEventLogWriteHandle.cs
- EditableTreeList.cs
- SiteMapDataSourceDesigner.cs
- SystemColors.cs
- ClientConfigurationSystem.cs
- DragEvent.cs
- DependentList.cs
- MultiBinding.cs
- COM2TypeInfoProcessor.cs
- ToolboxService.cs
- LicenseContext.cs
- BindingMemberInfo.cs
- SpecialFolderEnumConverter.cs
- Int64KeyFrameCollection.cs
- DataChangedEventManager.cs
- Parser.cs
- BoundColumn.cs
- DeflateStream.cs
- XslAstAnalyzer.cs
- ACE.cs