C# Class SIL.FieldWorks.Common.RootSites.SelectionHelper

ファイルを表示 Open project: sillsdev/FieldWorks Class Usage Examples

Public Properties

Property Type Description
s_mockedSelectionHelper SelectionHelper

Private Properties

Property Type Description
AppendLevel void
ContraryLimit SelLimitType
GetIndex int
GetSelEndInfo bool
GetSelInfo SelInfo
GetSelectionProps void
GetWsOfSelection int
InsertLevel void
IsEnd bool
MakeRangeSelection IVwSelection
OnRootSiteDisposed void
RemoveLevel void
RemoveLevelAt void

Public Methods

Method Description
AppendLevel ( int tag, int ihvo, int ws ) : void

Appends a selection level for the specified tag.

Create ( IVwRootSite rootSite ) : SelectionHelper

Create a SelectionHelper with the information about the current selection.

Create ( IVwSelection vwSel, IVwRootSite rootSite ) : SelectionHelper

Create a SelectionHelper with the information about the current selection.

GetAssocPrev ( SelLimitType type ) : bool

Indicates whether of not the insertion point should be associated with the characters immediately preceding it in the view (default) or not.

GetCurrSelectionProps ( ITsTextProps &vttp, IVwPropertyStore &vvps ) : void

Gets the selection props for the current selection

GetFirstWsOfSelection ( IVwSelection vwsel ) : int

Retrieve the first language writing system used by the given selection.

ENHANCE JohnT: Should this be a COM method for IVwSelection?

GetHardAndSoftCharProps ( IVwSelection vwSel, ITsTextProps &vttp, IVwPropertyStore &vvpsSoft, int &cttp ) : void

This is like GetSelectionProps, except that the vvpsSoft items include all formatting MINUS the hard formatting in the text properties (ie, those derived by the view constructor and styles).

GetIch ( SelLimitType type ) : int

Gets the 0-based index of the character for the given limit of the selection.

GetIhvoRoot ( SelLimitType type ) : int

Gets the index of the root object for the given limit of the selection. This is 0 for views that don't display mutliple root objects).

GetLevelForTag ( int tag ) : int

Returns the level number of the specified tag for this selection. NOTE: This version only searches the anchor for the specified tag.

GetLevelForTag ( int tag, SelLimitType limitType ) : int

Returns the level number of the specified tag for this selection.

GetLevelInfo ( SelLimitType type ) : SIL.FieldWorks.Common.COMInterfaces.SelLevInfo[]

Gets the array of VwSelLevInfo. Array elements should indicate the chain of objects that needs to be traversed to get from the root object to object where the selection is to be made. The tag for item n should be the flid in which the children of the root object are owned. The 0th element of this array must have its tag value set to BaseStText.StTextTags.kflidParagraphs. This is set automatically whenever the array is resized using Cvsli.

GetLevelInfoForTag ( int tag ) : SIL.FieldWorks.Common.COMInterfaces.SelLevInfo

Returns the selection level info for the specified tag found in the level info for this selection. NOTE: This version only searches the anchor for the specified tag.

GetLevelInfoForTag ( int tag, SelLimitType limitType ) : SIL.FieldWorks.Common.COMInterfaces.SelLevInfo

Returns the selection level info for the specified tag found in the level info for this selection.

GetLevelInfoForTag ( int tag, SIL.FieldWorks.Common.COMInterfaces.SelLevInfo &selLevInfo ) : bool

Retrieves the selection level info for the specified tag found in the level info for this selection. NOTE: This version only searches the anchor for the specified tag.

GetLevelInfoForTag ( int tag, SelLimitType limitType, SIL.FieldWorks.Common.COMInterfaces.SelLevInfo &selLevInfo ) : bool

Retrieves the selection level info for the specified tag found in the level info for this selection.

GetLocation ( ) : Point

Get the location of the selection TODO: Make this work in PrintLayout view

GetNumberOfLevels ( SelLimitType type ) : int

Gets the number of levels needed to traverse the view objects to reach the given limit of the selection.

GetNumberOfPreviousProps ( SelLimitType type ) : int

Gets the number of previous elements for the given limit of the selection

GetParaProps ( IVwSelection vwSel, IVwPropertyStore &vvps, int &cvps ) : void

Gets the paragraph properties for the specified IVwSelection

GetSelProps ( SelLimitType type ) : ITsTextProps

Get the text props associated with the given end of the selection.

GetSelectionInfo ( IVwSelection vwSel, IVwRootSite rootSite ) : SelectionHelper

Gets all information about a selection by calling IVwSelection.AllTextSelInfo.

GetTextPropId ( SelLimitType type ) : int

Gets the text property that occurs at the indicated end of the selection.

GetTss ( SelLimitType limit ) : ITsString

Get the TsString of the property where the given selection limit is located. This gets the entire TSS of the paragraph, not just the selected portion.

GetWritingSystem ( SelLimitType type ) : int

Get the writing system associated with the insertion point.

Note: If you need the writing system for the selection, you should use GetFirstWsOfSelection.

GetWsOfEntireSelection ( IVwSelection vwsel ) : int

Retrieve the language writing system used by the given selection. If the selection has no writing system or contains more than one writing system, zero is returned.

ENHANCE JohnT (DaveO): This should this be a COM method for IVwSelection

InsertLevel ( int iLev, int tag, int ihvo, int ws ) : void

Appends a selection level for the specified tag.

IsEditable ( ITsTextProps ttp, IVwPropertyStore vps ) : bool

Determine if text that belongs to ttp and vps is editable.

IsEditable ( IVwSelection sel ) : bool

Determine if selection is editable

IsFlidInLevelInfo ( int flid, SelLimitType limitType ) : bool

Determines whether the specified flid is located in the level info for the selection

MakeBest ( IVwRootSite rootsite, bool fMakeVisible ) : IVwSelection

The requested anchor and endpoint may be beyond the end of the string. Try to make a selection as near the end of the string as possible.

MakeBest ( bool fMakeVisible ) : IVwSelection

The requested anchor and endpoint may be beyond the end of the string. Try to make a selection as near the end of the string as possible.

MakeRangeSelection ( IVwRootBox rootBox, bool fInstall ) : IVwSelection

Make a range selection based upon our saved selection info. NOTE: Installing the selection may trigger side effects that will invalidate the selection. Callers should check to make sure the selection is still valid before using it.

ReduceSelectionToIp ( IVwRootSite rootSite, SelLimitType limit, bool fMakeVisible ) : SelectionHelper

Reduce a range selection to a simple insertion point, specifying which limit of the range selection to use as the position for the new IP.

ReduceSelectionToIp ( IVwRootSite rootSite, SelLimitType limit, bool fMakeVisible, bool fInstall ) : SelectionHelper

Reduce a range selection to a simple insertion point, specifying which limit of the range selection to use as the position for the new IP.

ReduceSelectionToIp ( SelLimitType limit, bool fMakeVisible, bool fInstall ) : SelectionHelper

Gets a (new) selection helper that represents an insertion point at the specified limit of this selection

ReduceToIp ( SelLimitType limit, bool fMakeVisible, bool fInstall ) : IVwSelection

This is the workhorse that actually reduces a range selection to a simple insertion point, given the specified index to indicate the limit where the IP is to be created.

ReduceToIp ( SelLimitType limit ) : void

Reduces this selection to an insertion point at the specified limit. Will not install or make visible.

RemoveLevel ( int tag ) : void

Removes the selection level for the specified tag.

RemoveLevelAt ( int ilev ) : void

Remove the specified level from the SelLevInfo for both ends.

RestoreScrollPos ( ) : void

Scrolls the selection to its original scroll position.

RestoreSelectionAndScrollPos ( ) : bool

Makes a selection then scrolls the window so the IP is at the same vertical position it was when this selection helper object was created. This method is used mainly after reconstructing a view. After reconstruction, the desire is to not only have the IP back in the data where it was before reconstruction, but to have the same number of pixels between the IP and the top of the view. This method does it's best to do this.

SelectionHelper ( ) : System

The default constructor must be followed by a call to SetSelection before it will really be useful

SelectionHelper ( SelectionHelper src ) : System

Copy constructor

SetAssocPrev ( SelLimitType type, bool value ) : void

Indicates whether of not the insertion point should be associated with the characters immediately preceding it in the view (default) or not.

SetIPAfterUOW ( ) : void

Make an insertion point based upon our saved anchor selection info. It will not be set until after the unit of work.

SetIPAfterUOW ( IVwRootSite rootSite ) : void

Make an insertion point based upon our saved anchor selection info. It will not be set until after the unit of work.

SetIch ( SelLimitType type, int value ) : void

Sets the 0-based index of the character for the given limit of the selection. If appropriate records that the end of the selection has been set explicitly.

SetIhvoRoot ( SelLimitType type, int value ) : void

Sets the index of the root object for the given limit of the selection. This is 0 for views that don't display mutliple root objects).

SetLevelInfo ( SelLimitType type, SIL.FieldWorks.Common.COMInterfaces.SelLevInfo value ) : void

Sets the array of SelLevInfo.

SetNumberOfLevels ( SelLimitType type, int value ) : void

Sets the number of levels needed to traverse the view objects to reach the given limit of the selection.

SetNumberOfPreviousProps ( SelLimitType type, int value ) : void

Sets the number of previous elements for the given limit of the selection

SetSelProps ( SelLimitType type, ITsTextProps value ) : void

Set the text props associated with the given end of the selection.

SetSelection ( IVwRootSite rootSite ) : IVwSelection

Sets the selection

SetSelection ( IVwRootSite rootSite, bool fInstall, bool fMakeVisible ) : IVwSelection

Sets the selection by calling IVwRootBox.MakeRangeSelection.

SetSelection ( IVwRootSite rootSite, bool fInstall, bool fMakeVisible, VwScrollSelOpts scrollOption ) : IVwSelection

Sets the selection by calling IVwRootBox.MakeRangeSelection.

SetSelection ( bool fMakeVisible ) : IVwSelection

Sets and install the selection in the previously supplied rootsite.

SetSelection ( bool fInstall, bool fMakeVisible ) : IVwSelection

Sets the selection by calling IVwRootBox.MakeRangeSelection.

SetTextPropId ( SelLimitType type, int tagTextProp ) : void

Sets the text property that occurs at the indicated end of the selection.

SetWritingSystem ( SelLimitType type, int value ) : void

Set the writing system associated with the insertion point.

Note: If you need the writing system for the selection, you should use GetFirstWsOfSelection.

UpdateScrollLocation ( ) : void

Updates the internal scroll location for this selection to be up-to-date, if possible.

Protected Methods

Method Description
SelectionHelper ( IVwSelection vwSel, IVwRootSite rootSite ) : System

Create a selection helper based on an existing selection

Private Methods

Method Description
AppendLevel ( int tag, int ihvo, int ws, SelLimitType type ) : void

Appends a selection level for the specified tag.

ContraryLimit ( SelLimitType limit ) : SelLimitType

Returns the contrary limit

GetIndex ( SelLimitType type ) : int

Returns the index used for the appropriate limit type

GetSelEndInfo ( bool fEnd ) : bool

Get information about the selection

GetSelInfo ( SelLimitType type ) : SelInfo

Gets the internal selection info for the requested end of the selection.

GetSelectionProps ( IVwSelection vwSel, ITsTextProps &vttp, IVwPropertyStore &vvps, int &cttp ) : void
GetWsOfSelection ( IVwSelection vwsel, bool fStopAtFirstWs ) : int

This is the implementation for GetWsOfEntireSelection and GetFirstWsOfSelection. It retrieves the language writing system used by the given selection.

ENHANCE JohnT: Should this be a COM method for IVwSelection?

InsertLevel ( int iLev, int tag, int ihvo, int ws, SelLimitType type ) : void

Appends a selection level for the specified tag.

IsEnd ( SelLimitType type ) : bool

Determines whether the specified type is the end.

MakeRangeSelection ( IVwRootSite rootSite, bool fInstall ) : IVwSelection

Make a range selection based upon our saved selection info. NOTE: Installing the selection may trigger side effects that will invalidate the selection. Callers should check to make sure the selection is still valid before using it.

OnRootSiteDisposed ( object sender, EventArgs e ) : void

Called when the root site gets disposed. We can't use m_rootSite any more.

RemoveLevel ( int tag, SelLimitType type ) : void

Removes the selection level for the specified tag.

RemoveLevelAt ( int iLevel, SelLimitType type ) : void

Method Details

AppendLevel() public method

Appends a selection level for the specified tag.
public AppendLevel ( int tag, int ihvo, int ws ) : void
tag int The tag.
ihvo int The index of the object to insert in the appended level
ws int HVO of the writing system, if the property is a Multitext
return void

Create() public static method

Create a SelectionHelper with the information about the current selection.
public static Create ( IVwRootSite rootSite ) : SelectionHelper
rootSite IVwRootSite The root site
return SelectionHelper

Create() public static method

Create a SelectionHelper with the information about the current selection.
public static Create ( IVwSelection vwSel, IVwRootSite rootSite ) : SelectionHelper
vwSel IVwSelection The selection to create a SelectionHelper object from or /// null to create it from the given RootSite
rootSite IVwRootSite The root site
return SelectionHelper

GetAssocPrev() public method

Indicates whether of not the insertion point should be associated with the characters immediately preceding it in the view (default) or not.
public GetAssocPrev ( SelLimitType type ) : bool
type SelLimitType Which end of the selection
return bool

GetCurrSelectionProps() public method

Gets the selection props for the current selection
public GetCurrSelectionProps ( ITsTextProps &vttp, IVwPropertyStore &vvps ) : void
vttp ITsTextProps Returned array of ITsTextProps in the selection
vvps IVwPropertyStore Returned array of IVwPropertyStores in the selection
return void

GetFirstWsOfSelection() public static method

Retrieve the first language writing system used by the given selection.
ENHANCE JohnT: Should this be a COM method for IVwSelection?
public static GetFirstWsOfSelection ( IVwSelection vwsel ) : int
vwsel IVwSelection The selection
return int

GetHardAndSoftCharProps() public static method

This is like GetSelectionProps, except that the vvpsSoft items include all formatting MINUS the hard formatting in the text properties (ie, those derived by the view constructor and styles).
public static GetHardAndSoftCharProps ( IVwSelection vwSel, ITsTextProps &vttp, IVwPropertyStore &vvpsSoft, int &cttp ) : void
vwSel IVwSelection The view Selection
vttp ITsTextProps Returned array of ITsTextProps in the selection
vvpsSoft IVwPropertyStore Returned array of IVwPropertyStores in the selection
cttp int Returned count of properties
return void

GetIch() public method

Gets the 0-based index of the character for the given limit of the selection.
public GetIch ( SelLimitType type ) : int
type SelLimitType
return int

GetIhvoRoot() public method

Gets the index of the root object for the given limit of the selection. This is 0 for views that don't display mutliple root objects).
public GetIhvoRoot ( SelLimitType type ) : int
type SelLimitType Anchor or End
return int

GetLevelForTag() public method

Returns the level number of the specified tag for this selection. NOTE: This version only searches the anchor for the specified tag.
public GetLevelForTag ( int tag ) : int
tag int The field tag to search for /// (i.e. BaseStText.StTextTags.kflidParagraphs)
return int

GetLevelForTag() public method

Returns the level number of the specified tag for this selection.
public GetLevelForTag ( int tag, SelLimitType limitType ) : int
tag int The field tag to search for /// (i.e. BaseStText.StTextTags.kflidParagraphs)
limitType SelLimitType The limit of the selection to search for the specified tag ///
return int

GetLevelInfo() public method

Gets the array of VwSelLevInfo. Array elements should indicate the chain of objects that needs to be traversed to get from the root object to object where the selection is to be made. The tag for item n should be the flid in which the children of the root object are owned. The 0th element of this array must have its tag value set to BaseStText.StTextTags.kflidParagraphs. This is set automatically whenever the array is resized using Cvsli.
public GetLevelInfo ( SelLimitType type ) : SIL.FieldWorks.Common.COMInterfaces.SelLevInfo[]
type SelLimitType type
return SIL.FieldWorks.Common.COMInterfaces.SelLevInfo[]

GetLevelInfoForTag() public method

Returns the selection level info for the specified tag found in the level info for this selection. NOTE: This version only searches the anchor for the specified tag.
Thrown if the specified tag is not found in the level /// info for the Anchor of the selection
public GetLevelInfoForTag ( int tag ) : SIL.FieldWorks.Common.COMInterfaces.SelLevInfo
tag int The field tag to search for /// (i.e. BaseStText.StTextTags.kflidParagraphs)
return SIL.FieldWorks.Common.COMInterfaces.SelLevInfo

GetLevelInfoForTag() public method

Returns the selection level info for the specified tag found in the level info for this selection.
Thrown if the specified tag is not found in the level /// info of the selection
public GetLevelInfoForTag ( int tag, SelLimitType limitType ) : SIL.FieldWorks.Common.COMInterfaces.SelLevInfo
tag int The field tag to search for /// (i.e. BaseStText.StTextTags.kflidParagraphs)
limitType SelLimitType The limit of the selection to search for the specified tag ///
return SIL.FieldWorks.Common.COMInterfaces.SelLevInfo

GetLevelInfoForTag() public method

Retrieves the selection level info for the specified tag found in the level info for this selection. NOTE: This version only searches the anchor for the specified tag.
public GetLevelInfoForTag ( int tag, SIL.FieldWorks.Common.COMInterfaces.SelLevInfo &selLevInfo ) : bool
tag int The field tag to search for /// (i.e. BaseStText.StTextTags.kflidParagraphs)
selLevInfo SIL.FieldWorks.Common.COMInterfaces.SelLevInfo The level info for the specified tag, if found; undefined /// otherwise
return bool

GetLevelInfoForTag() public method

Retrieves the selection level info for the specified tag found in the level info for this selection.
public GetLevelInfoForTag ( int tag, SelLimitType limitType, SIL.FieldWorks.Common.COMInterfaces.SelLevInfo &selLevInfo ) : bool
tag int The field tag to search for /// (i.e. BaseStText.StTextTags.kflidParagraphs)
limitType SelLimitType The limit of the selection to search for the specified tag ///
selLevInfo SIL.FieldWorks.Common.COMInterfaces.SelLevInfo The level info for the specified tag, if found; undefined /// otherwise
return bool

GetLocation() public method

Get the location of the selection TODO: Make this work in PrintLayout view
public GetLocation ( ) : Point
return Point

GetNumberOfLevels() public method

Gets the number of levels needed to traverse the view objects to reach the given limit of the selection.
public GetNumberOfLevels ( SelLimitType type ) : int
type SelLimitType
return int

GetNumberOfPreviousProps() public method

Gets the number of previous elements for the given limit of the selection
public GetNumberOfPreviousProps ( SelLimitType type ) : int
type SelLimitType Anchor or End
return int

GetParaProps() public static method

Gets the paragraph properties for the specified IVwSelection
public static GetParaProps ( IVwSelection vwSel, IVwPropertyStore &vvps, int &cvps ) : void
vwSel IVwSelection The view Selection
vvps IVwPropertyStore Returned array of IVwPropertyStores in the selection
cvps int Returned count of IVwPropertyStores
return void

GetSelProps() public method

Get the text props associated with the given end of the selection.
public GetSelProps ( SelLimitType type ) : ITsTextProps
type SelLimitType Which end of the selection
return ITsTextProps

GetSelectionInfo() public static method

Gets all information about a selection by calling IVwSelection.AllTextSelInfo.
public static GetSelectionInfo ( IVwSelection vwSel, IVwRootSite rootSite ) : SelectionHelper
vwSel IVwSelection The selection to get info for, or null to get current /// selection.
rootSite IVwRootSite The root site
return SelectionHelper

GetTextPropId() public method

Gets the text property that occurs at the indicated end of the selection.
public GetTextPropId ( SelLimitType type ) : int
type SelLimitType
return int

GetTss() public method

Get the TsString of the property where the given selection limit is located. This gets the entire TSS of the paragraph, not just the selected portion.
public GetTss ( SelLimitType limit ) : ITsString
limit SelLimitType the part of the selection where tss is to be retrieved (top, /// bottom, end, anchor)
return ITsString

GetWritingSystem() public method

Get the writing system associated with the insertion point.

Note: If you need the writing system for the selection, you should use GetFirstWsOfSelection.

public GetWritingSystem ( SelLimitType type ) : int
type SelLimitType Which end of the selection
return int

GetWsOfEntireSelection() public static method

Retrieve the language writing system used by the given selection. If the selection has no writing system or contains more than one writing system, zero is returned.
ENHANCE JohnT (DaveO): This should this be a COM method for IVwSelection
public static GetWsOfEntireSelection ( IVwSelection vwsel ) : int
vwsel IVwSelection The selection
return int

InsertLevel() public method

Appends a selection level for the specified tag.
public InsertLevel ( int iLev, int tag, int ihvo, int ws ) : void
iLev int Index at which the level is to be inserted.
tag int The tag.
ihvo int The index of the object to insert in the appended level
ws int HVO of the writing system, if the property is a Multitext
return void

IsEditable() public static method

Determine if text that belongs to ttp and vps is editable.
public static IsEditable ( ITsTextProps ttp, IVwPropertyStore vps ) : bool
ttp ITsTextProps
vps IVwPropertyStore
return bool

IsEditable() public static method

Determine if selection is editable
public static IsEditable ( IVwSelection sel ) : bool
sel IVwSelection Selection
return bool

IsFlidInLevelInfo() public method

Determines whether the specified flid is located in the level info for the selection
public IsFlidInLevelInfo ( int flid, SelLimitType limitType ) : bool
flid int The flid.
limitType SelLimitType Type of the limit.
return bool

MakeBest() public method

The requested anchor and endpoint may be beyond the end of the string. Try to make a selection as near the end of the string as possible.
public MakeBest ( IVwRootSite rootsite, bool fMakeVisible ) : IVwSelection
rootsite IVwRootSite The rootsite that will try take the selection
fMakeVisible bool Indicates whether to scroll the selection into view ///
return IVwSelection

MakeBest() public method

The requested anchor and endpoint may be beyond the end of the string. Try to make a selection as near the end of the string as possible.
public MakeBest ( bool fMakeVisible ) : IVwSelection
fMakeVisible bool Indicates whether to scroll the selection into view ///
return IVwSelection

MakeRangeSelection() public method

Make a range selection based upon our saved selection info. NOTE: Installing the selection may trigger side effects that will invalidate the selection. Callers should check to make sure the selection is still valid before using it.
throws if unable to make an end selection
public MakeRangeSelection ( IVwRootBox rootBox, bool fInstall ) : IVwSelection
rootBox IVwRootBox
fInstall bool
return IVwSelection

ReduceSelectionToIp() public static method

Reduce a range selection to a simple insertion point, specifying which limit of the range selection to use as the position for the new IP.
public static ReduceSelectionToIp ( IVwRootSite rootSite, SelLimitType limit, bool fMakeVisible ) : SelectionHelper
rootSite IVwRootSite The root site
limit SelLimitType Specify Top to place the IP at the top-most limit of the /// selection. Specify Bottom to place the IP at the bottom-most limit of the selection. /// Specify Anchor to place the IP at the point where the user initiated the selection. /// Specify End to place the IP at the point where the user completed the selection. Be /// aware the user may select text in either direction, thus the end of the selection\ /// could be visually before the anchor. For a simple insertion point or a selection /// entirely within a single StText, this parameter doesn't actually make any /// difference.
fMakeVisible bool Indicates whether to scroll the IP into view.
return SelectionHelper

ReduceSelectionToIp() public static method

Reduce a range selection to a simple insertion point, specifying which limit of the range selection to use as the position for the new IP.
public static ReduceSelectionToIp ( IVwRootSite rootSite, SelLimitType limit, bool fMakeVisible, bool fInstall ) : SelectionHelper
rootSite IVwRootSite The root site
limit SelLimitType Specify Top to place the IP at the top-most limit of the /// selection. Specify Bottom to place the IP at the bottom-most limit of the selection. /// Specify Anchor to place the IP at the point where the user initiated the selection. /// Specify End to place the IP at the point where the user completed the selection. Be /// aware the user may select text in either direction, thus the end of the selection\ /// could be visually before the anchor. For a simple insertion point or a selection /// entirely within a single StText, this parameter doesn't actually make any /// difference.
fMakeVisible bool Indicates whether to scroll the IP into view.
fInstall bool True to install the created selection, false otherwise
return SelectionHelper

ReduceSelectionToIp() public method

Gets a (new) selection helper that represents an insertion point at the specified limit of this selection
public ReduceSelectionToIp ( SelLimitType limit, bool fMakeVisible, bool fInstall ) : SelectionHelper
limit SelLimitType Specify Top to place the IP at the top-most limit of the /// selection. Specify Bottom to place the IP at the bottom-most limit of the selection. /// Specify Anchor to place the IP at the point where the user initiated the selection. /// Specify End to place the IP at the point where the user completed the selection. Be /// aware the user may select text in either direction, thus the end of the selection\ /// could be visually before the anchor. For a simple insertion point or a selection /// entirely within a single StText, this parameter doesn't actually make any /// difference.
fMakeVisible bool Indicates whether to scroll the IP into view.
fInstall bool True to install the created selection, false otherwise
return SelectionHelper

ReduceToIp() public method

This is the workhorse that actually reduces a range selection to a simple insertion point, given the specified index to indicate the limit where the IP is to be created.
public ReduceToIp ( SelLimitType limit, bool fMakeVisible, bool fInstall ) : IVwSelection
limit SelLimitType The current selection limit to reduce to
fMakeVisible bool Indicates whether to scroll the IP into view.
fInstall bool True to install the created selection, false otherwise
return IVwSelection

ReduceToIp() public method

Reduces this selection to an insertion point at the specified limit. Will not install or make visible.
public ReduceToIp ( SelLimitType limit ) : void
limit SelLimitType The current selection limit to reduce to
return void

RemoveLevel() public method

Removes the selection level for the specified tag.
public RemoveLevel ( int tag ) : void
tag int The tag.
return void

RemoveLevelAt() public method

Remove the specified level from the SelLevInfo for both ends.
public RemoveLevelAt ( int ilev ) : void
ilev int
return void

RestoreScrollPos() public method

Scrolls the selection to its original scroll position.
public RestoreScrollPos ( ) : void
return void

RestoreSelectionAndScrollPos() public method

Makes a selection then scrolls the window so the IP is at the same vertical position it was when this selection helper object was created. This method is used mainly after reconstructing a view. After reconstruction, the desire is to not only have the IP back in the data where it was before reconstruction, but to have the same number of pixels between the IP and the top of the view. This method does it's best to do this.
public RestoreSelectionAndScrollPos ( ) : bool
return bool

SelectionHelper() public method

The default constructor must be followed by a call to SetSelection before it will really be useful
public SelectionHelper ( ) : System
return System

SelectionHelper() protected method

Create a selection helper based on an existing selection
protected SelectionHelper ( IVwSelection vwSel, IVwRootSite rootSite ) : System
vwSel IVwSelection
rootSite IVwRootSite
return System

SelectionHelper() public method

Copy constructor
public SelectionHelper ( SelectionHelper src ) : System
src SelectionHelper The source object
return System

SetAssocPrev() public method

Indicates whether of not the insertion point should be associated with the characters immediately preceding it in the view (default) or not.
public SetAssocPrev ( SelLimitType type, bool value ) : void
type SelLimitType Which end of the selection
value bool true to associate IP with preceding characters, otherwise /// false
return void

SetIPAfterUOW() public method

Make an insertion point based upon our saved anchor selection info. It will not be set until after the unit of work.
public SetIPAfterUOW ( ) : void
return void

SetIPAfterUOW() public method

Make an insertion point based upon our saved anchor selection info. It will not be set until after the unit of work.
public SetIPAfterUOW ( IVwRootSite rootSite ) : void
rootSite IVwRootSite
return void

SetIch() public method

Sets the 0-based index of the character for the given limit of the selection. If appropriate records that the end of the selection has been set explicitly.
public SetIch ( SelLimitType type, int value ) : void
type SelLimitType
value int
return void

SetIhvoRoot() public method

Sets the index of the root object for the given limit of the selection. This is 0 for views that don't display mutliple root objects).
public SetIhvoRoot ( SelLimitType type, int value ) : void
type SelLimitType
value int
return void

SetLevelInfo() public method

Sets the array of SelLevInfo.
public SetLevelInfo ( SelLimitType type, SIL.FieldWorks.Common.COMInterfaces.SelLevInfo value ) : void
type SelLimitType type
value SIL.FieldWorks.Common.COMInterfaces.SelLevInfo The level info
return void

SetNumberOfLevels() public method

Sets the number of levels needed to traverse the view objects to reach the given limit of the selection.
public SetNumberOfLevels ( SelLimitType type, int value ) : void
type SelLimitType
value int
return void

SetNumberOfPreviousProps() public method

Sets the number of previous elements for the given limit of the selection
public SetNumberOfPreviousProps ( SelLimitType type, int value ) : void
type SelLimitType
value int
return void

SetSelProps() public method

Set the text props associated with the given end of the selection.
public SetSelProps ( SelLimitType type, ITsTextProps value ) : void
type SelLimitType Which end of the selection
value ITsTextProps Properties to set for the selection
return void

SetSelection() public method

Sets the selection
public SetSelection ( IVwRootSite rootSite ) : IVwSelection
rootSite IVwRootSite The root site
return IVwSelection

SetSelection() public method

Sets the selection by calling IVwRootBox.MakeRangeSelection.
public SetSelection ( IVwRootSite rootSite, bool fInstall, bool fMakeVisible ) : IVwSelection
rootSite IVwRootSite The root site
fInstall bool Makes the selection the current selection
fMakeVisible bool Determines whether or not to make the selection visible. ///
return IVwSelection

SetSelection() public method

Sets the selection by calling IVwRootBox.MakeRangeSelection.
public SetSelection ( IVwRootSite rootSite, bool fInstall, bool fMakeVisible, VwScrollSelOpts scrollOption ) : IVwSelection
rootSite IVwRootSite The root site
fInstall bool Makes the selection the current selection
fMakeVisible bool Determines whether or not to make the selection visible. ///
scrollOption VwScrollSelOpts Where to scroll the selection
return IVwSelection

SetSelection() public method

Sets and install the selection in the previously supplied rootsite.
public SetSelection ( bool fMakeVisible ) : IVwSelection
fMakeVisible bool Indicates whether to scroll the selection into view ///
return IVwSelection

SetSelection() public method

Sets the selection by calling IVwRootBox.MakeRangeSelection.
public SetSelection ( bool fInstall, bool fMakeVisible ) : IVwSelection
fInstall bool Makes the selection the current selection
fMakeVisible bool Determines whether or not to make the selection visible. ///
return IVwSelection

SetTextPropId() public method

Sets the text property that occurs at the indicated end of the selection.
public SetTextPropId ( SelLimitType type, int tagTextProp ) : void
type SelLimitType Anchor or End
tagTextProp int Text property
return void

SetWritingSystem() public method

Set the writing system associated with the insertion point.

Note: If you need the writing system for the selection, you should use GetFirstWsOfSelection.

public SetWritingSystem ( SelLimitType type, int value ) : void
type SelLimitType Which end of the selection
value int Writing system
return void

UpdateScrollLocation() public method

Updates the internal scroll location for this selection to be up-to-date, if possible.
public UpdateScrollLocation ( ) : void
return void

Property Details

s_mockedSelectionHelper public_oe static_oe property

Used for testing: holds SelectionHelper mock
public static SelectionHelper,SIL.FieldWorks.Common.RootSites s_mockedSelectionHelper
return SelectionHelper