C# Класс SIL.FieldWorks.Common.Controls.XmlViewsUtils

Utility functions for XmlViews. Some of these may eventually migrate to a more general Utils if relevant.
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
s_cwsMulti int
s_fMultiFirst bool
s_qwsCurrent IWritingSystem
s_sMultiSep string

Открытые методы

Метод Описание
AlphaCompNumberString ( int val ) : string

Return a string such that ICU alphabetic comparison of the strings will produce the same results as numberic comparison of the values. For positive integers the string is a recognizeable representation of the number (with extra leading zeros); for negative, it is not recognizeable but works.

AlphaCompPosNumString ( int val ) : string

Alphas the comp pos num string.

Assemble ( string items ) : string[]

Return the concatenation of all the input strings as a single string.

CollectBrowseItems ( int hvo, XmlNode colSpec, ArrayList collector, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts ) : void

Given one of the original list items, and the spec of the column we want to sort by, add to collector whatever ManyOnePathSortItems are appropriate.

CopyReplacingParamDefault ( XmlNode input, string paramId, string val ) : XmlNode

Copies the replacing param default.

CopyWithParamDefaults ( XmlNode input ) : XmlNode

If any attributes of input (or its children) are of the form "$param=default", generate a complete copy of input in which "$param=default" is replaced with "default", and return it. Otherwise just return input.

CorrespondingItems ( List sourceNodes, List selectNodes, string attName ) : List

Answer a list containing, for each node in selectNodes, the item in sourceNodes that has the same value for the attribute attName.

DateTimeCompString ( System.DateTime dt ) : string

Return a string such that ICU alphabetic comparison of the strings will produce the same results as DateTime.Compare of the values.

FindIndexOfAttrVal ( List nodes, string attName, string attVal, SIL.Utils.StringTable tbl ) : int

Find the index of the node in nodes that has value attVal for attribute attName. Return -1 if not found.

FindIndexOfMatchingNode ( IEnumerable nodes, XmlNode target ) : int

Find the index of the node in nodes that 'matches' the target node. Return -1 if not found.

FindNodeWithAttrVal ( List nodes, string attName, string attVal, SIL.Utils.StringTable tbl ) : XmlNode

Finds the node with attr val.

FindParams ( XmlNode input ) : string[]

Finds the params.

FindWsParam ( XmlNode node ) : string

Search the node for an element with an attribute that has a value that looks like "$ws=..." and return the "...".

GetDisplayCommandForColumn ( IManyOnePathSortItem bvi, XmlNode colSpec, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int &hvo, List collectOuterStructParts ) : NodeDisplayCommand

This returns a NodeDisplayCommand containing thd node for GetNodeToUseForColumn. However, it distinguishes whether to display the children of this node or the node itself by returning the appropriate kind of NodeDisplayCommand.

GetGuidForUnspecifiedComplexFormType ( ) : System.Guid

Returns a 'fake' Guid used to filter unspecified Complex Form types in XmlVc. Setup in configuration files by XmlDocConfigureDlg.

GetGuidForUnspecifiedVariantType ( ) : System.Guid

Returns a 'fake' Guid used to filter unspecified Variant types in XmlVc. Setup in configuration files by XmlDocConfigureDlg.

GetNodeToUseForColumn ( IManyOnePathSortItem bvi, XmlNode colSpec, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int &hvo, List collectOuterStructParts ) : XmlNode

We want to display the object bvi.KeyObject, or one of its pathobjects, in a column specified by colSpec. Determine the hvo and XmlNode that we should use as the root for the cell. By default, we display the first object in the path, using the base node derived from the colSpec. However, if the colSpec begins with a path compatible with bvi.PathFlid(0), we can use bvi.PathObject(1) and the appropriate derived node. If all flids match we can use bvi.KeyObject itself. If collectOuterStructParts is non-null, it accumulates containing parts that are structural, like para, span, div.

GetWsFromString ( string wsParam, SIL.FieldWorks.FDO.FdoCache cache ) : int

Convert the string found for a writing system to the appropriate integer code (hvo).

GetWsRequiresObject ( XmlNode frag ) : bool

Return true if the specified fragment requires an hvo (and possibly flid) for its interpretation. Currently this assumes just the "ws" attribute, since smartws is obsolete.

GetWsRequiresObject ( string wsSpec ) : bool

Return true if the specified fragment requires an hvo (and possibly flid) for its interpretation. Currently this assumes just the "ws" attribute, since smartws is obsolete.

HasParam ( XmlNode input ) : bool

Find the value of the first parameter-like attribute value "$param=default"

StringsFor ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode layout, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]

Returns an array of string values (keys) for the objects under this layout node.

TryFindPluralFormFromClassId ( IFwMetaDataCache mdc, SIL.Utils.StringTable tbl, int clsId, string &titleStr ) : bool

TryFindPluralFormFromFlid ( IFwMetaDataCache mdc, SIL.Utils.StringTable tbl, int owningFlid, string &titleStr ) : bool

looks up plural form alternative first for given flid, secondly for its destination class.

TryFindString ( SIL.Utils.StringTable tbl, string group, string key, string &result ) : bool

TryMatchExistingAttributes ( XmlNode colSpec1, XmlNode colSpec2, Queue &possibleAttributesToMatch ) : bool

go through possible attributes to match, and return true when the ones that exist match the same attributes in another node.

Приватные методы

Метод Описание
AddMultipleAlternatives ( SIL.FieldWorks.FDO.FdoCache cache, ISilDataAccess sda, IEnumerable wsIds, int hvo, int flid, XmlNode frag ) : string
AddSeparator ( string &item, int ichInsert, XmlNode layout ) : void
AddStringFromOtherObj ( XmlNode frag, int hvoTarget, SIL.FieldWorks.FDO.FdoCache cache, ISilDataAccess sda ) : string[]
AppendInt ( int sofar, int add ) : int[]
AssembleChildKeys ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode layout, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]
ChildKeys ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode layout, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]

Returns an array of string values (keys) for the objects under the layout child nodes.

CollectBrowseItems ( int hvo, XmlNode node, ArrayList collector, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, XmlNode caller, int hvos, int flids ) : void

Main (recursive) part of CollectBrowseItems. Given that hvo is to be displayed using node, figure what objects to put in the list.

Concatenate ( string first, string second ) : string[]
DisplayMultiSep ( XmlNode frag ) : string
DisplayWsLabel ( IWritingSystem ws, SIL.FieldWorks.FDO.FdoCache cache ) : string
FindMainChild ( XmlNode node ) : XmlNode

Finds the main child.

FoundStringTableString ( string key, string result ) : bool

determine if string table query gave a significant result (i.e. not *{key}* format).

GetArrayLength ( string items ) : int
GetDisplayCommandForColumn1 ( IManyOnePathSortItem bvi, XmlNode node, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int depth, int &hvo, List collectOuterStructParts ) : NodeDisplayCommand

Recursive implementation method for GetDisplayCommandForColumn.

GetFlid ( ISilDataAccess sda, XmlNode frag, int hvo ) : int

This is a simplified version of XmlVc.GetFlid. It does not look for a flid attr, nor try to cache the result. It looks for a "field" property, and optionally a "class" one, and uses them (or the class of hvo, if "class" is missing) to figure the flid. Virtual properties are assumed already created.

GetLayoutNodeForChild ( ISilDataAccess sda, int hvoTarget, int flid, string targetLayoutName, XmlNode layout, LayoutCache layoutCache ) : XmlNode
GetNodeForRelatedObject ( int hvoDst, XmlNode caller, XmlNode node, LayoutCache layouts, ISilDataAccess sda ) : XmlNode

The node argument is an "obj" or "seq" element, and caller (if not null) is a part element that invoked the node and may override its "layout" attribute. Apply the same logic used by XmlVc to determine the node that will be used to display the destination object hvoDst

ProcessMultiLingualChildren ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode frag, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]

Process a fragment's children against multiple writing systems.

XmlViewsUtils ( ) : System

Описание методов

AlphaCompNumberString() публичный статический Метод

Return a string such that ICU alphabetic comparison of the strings will produce the same results as numberic comparison of the values. For positive integers the string is a recognizeable representation of the number (with extra leading zeros); for negative, it is not recognizeable but works.
public static AlphaCompNumberString ( int val ) : string
val int
Результат string

AlphaCompPosNumString() публичный статический Метод

Alphas the comp pos num string.
public static AlphaCompPosNumString ( int val ) : string
val int The val.
Результат string

Assemble() статический публичный Метод

Return the concatenation of all the input strings as a single string.
static public Assemble ( string items ) : string[]
items string
Результат string[]

CollectBrowseItems() публичный статический Метод

Given one of the original list items, and the spec of the column we want to sort by, add to collector whatever ManyOnePathSortItems are appropriate.
public static CollectBrowseItems ( int hvo, XmlNode colSpec, ArrayList collector, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts ) : void
hvo int The hvo.
colSpec System.Xml.XmlNode The col spec.
collector System.Collections.ArrayList The collector.
mdc IFwMetaDataCache The MDC.
sda ISilDataAccess The sda.
layouts LayoutCache The layouts.
Результат void

CopyReplacingParamDefault() публичный статический Метод

Copies the replacing param default.
public static CopyReplacingParamDefault ( XmlNode input, string paramId, string val ) : XmlNode
input System.Xml.XmlNode The input.
paramId string The param id.
val string The val.
Результат System.Xml.XmlNode

CopyWithParamDefaults() публичный статический Метод

If any attributes of input (or its children) are of the form "$param=default", generate a complete copy of input in which "$param=default" is replaced with "default", and return it. Otherwise just return input.
public static CopyWithParamDefaults ( XmlNode input ) : XmlNode
input System.Xml.XmlNode
Результат System.Xml.XmlNode

CorrespondingItems() публичный статический Метод

Answer a list containing, for each node in selectNodes, the item in sourceNodes that has the same value for the attribute attName.
public static CorrespondingItems ( List sourceNodes, List selectNodes, string attName ) : List
sourceNodes List
selectNodes List
attName string
Результат List

DateTimeCompString() публичный статический Метод

Return a string such that ICU alphabetic comparison of the strings will produce the same results as DateTime.Compare of the values.
public static DateTimeCompString ( System.DateTime dt ) : string
dt System.DateTime
Результат string

FindIndexOfAttrVal() публичный статический Метод

Find the index of the node in nodes that has value attVal for attribute attName. Return -1 if not found.
public static FindIndexOfAttrVal ( List nodes, string attName, string attVal, SIL.Utils.StringTable tbl ) : int
nodes List The nodes.
attName string Name of the att.
attVal string The att val.
tbl SIL.Utils.StringTable The TBL.
Результат int

FindIndexOfMatchingNode() публичный статический Метод

Find the index of the node in nodes that 'matches' the target node. Return -1 if not found.
public static FindIndexOfMatchingNode ( IEnumerable nodes, XmlNode target ) : int
nodes IEnumerable The nodes.
target System.Xml.XmlNode The target.
Результат int

FindNodeWithAttrVal() публичный статический Метод

Finds the node with attr val.
public static FindNodeWithAttrVal ( List nodes, string attName, string attVal, SIL.Utils.StringTable tbl ) : XmlNode
nodes List The nodes.
attName string Name of the att.
attVal string The att val.
tbl SIL.Utils.StringTable The TBL.
Результат System.Xml.XmlNode

FindParams() публичный статический Метод

Finds the params.
public static FindParams ( XmlNode input ) : string[]
input System.Xml.XmlNode The input.
Результат string[]

FindWsParam() публичный статический Метод

Search the node for an element with an attribute that has a value that looks like "$ws=..." and return the "...".
public static FindWsParam ( XmlNode node ) : string
node System.Xml.XmlNode
Результат string

GetDisplayCommandForColumn() публичный статический Метод

This returns a NodeDisplayCommand containing thd node for GetNodeToUseForColumn. However, it distinguishes whether to display the children of this node or the node itself by returning the appropriate kind of NodeDisplayCommand.
public static GetDisplayCommandForColumn ( IManyOnePathSortItem bvi, XmlNode colSpec, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int &hvo, List collectOuterStructParts ) : NodeDisplayCommand
bvi IManyOnePathSortItem
colSpec System.Xml.XmlNode
mdc IFwMetaDataCache
sda ISilDataAccess
layouts LayoutCache
hvo int
collectOuterStructParts List
Результат NodeDisplayCommand

GetGuidForUnspecifiedComplexFormType() публичный статический Метод

Returns a 'fake' Guid used to filter unspecified Complex Form types in XmlVc. Setup in configuration files by XmlDocConfigureDlg.
public static GetGuidForUnspecifiedComplexFormType ( ) : System.Guid
Результат System.Guid

GetGuidForUnspecifiedVariantType() публичный статический Метод

Returns a 'fake' Guid used to filter unspecified Variant types in XmlVc. Setup in configuration files by XmlDocConfigureDlg.
public static GetGuidForUnspecifiedVariantType ( ) : System.Guid
Результат System.Guid

GetNodeToUseForColumn() публичный статический Метод

We want to display the object bvi.KeyObject, or one of its pathobjects, in a column specified by colSpec. Determine the hvo and XmlNode that we should use as the root for the cell. By default, we display the first object in the path, using the base node derived from the colSpec. However, if the colSpec begins with a path compatible with bvi.PathFlid(0), we can use bvi.PathObject(1) and the appropriate derived node. If all flids match we can use bvi.KeyObject itself. If collectOuterStructParts is non-null, it accumulates containing parts that are structural, like para, span, div.
public static GetNodeToUseForColumn ( IManyOnePathSortItem bvi, XmlNode colSpec, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int &hvo, List collectOuterStructParts ) : XmlNode
bvi IManyOnePathSortItem The bvi.
colSpec System.Xml.XmlNode The col spec.
mdc IFwMetaDataCache The MDC.
sda ISilDataAccess The sda.
layouts LayoutCache The layouts.
hvo int The hvo.
collectOuterStructParts List The collect outer struct parts.
Результат System.Xml.XmlNode

GetWsFromString() публичный статический Метод

Convert the string found for a writing system to the appropriate integer code (hvo).
public static GetWsFromString ( string wsParam, SIL.FieldWorks.FDO.FdoCache cache ) : int
wsParam string
cache SIL.FieldWorks.FDO.FdoCache
Результат int

GetWsRequiresObject() публичный статический Метод

Return true if the specified fragment requires an hvo (and possibly flid) for its interpretation. Currently this assumes just the "ws" attribute, since smartws is obsolete.
public static GetWsRequiresObject ( XmlNode frag ) : bool
frag System.Xml.XmlNode
Результат bool

GetWsRequiresObject() публичный статический Метод

Return true if the specified fragment requires an hvo (and possibly flid) for its interpretation. Currently this assumes just the "ws" attribute, since smartws is obsolete.
public static GetWsRequiresObject ( string wsSpec ) : bool
wsSpec string
Результат bool

HasParam() публичный статический Метод

Find the value of the first parameter-like attribute value "$param=default"
public static HasParam ( XmlNode input ) : bool
input System.Xml.XmlNode
Результат bool

StringsFor() статический публичный Метод

Returns an array of string values (keys) for the objects under this layout node.
static public StringsFor ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode layout, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]
fdoCache SIL.FieldWorks.FDO.FdoCache The fdo cache.
sda ISilDataAccess The sda.
layout System.Xml.XmlNode The layout.
hvo int The hvo.
layoutCache LayoutCache The layout cache.
caller System.Xml.XmlNode where layout is a component of a 'part' element, caller /// is the 'part ref' that invoked it.
stringTbl SIL.Utils.StringTable The string TBL.
wsForce int if non-zero, "string" elements are forced to use that writing system for multistrings.
Результат string[]

TryFindPluralFormFromClassId() публичный статический Метод

public static TryFindPluralFormFromClassId ( IFwMetaDataCache mdc, SIL.Utils.StringTable tbl, int clsId, string &titleStr ) : bool
mdc IFwMetaDataCache
tbl SIL.Utils.StringTable
clsId int
titleStr string *{dstClass}* if couldn't find result.
Результат bool

TryFindPluralFormFromFlid() публичный статический Метод

looks up plural form alternative first for given flid, secondly for its destination class.
public static TryFindPluralFormFromFlid ( IFwMetaDataCache mdc, SIL.Utils.StringTable tbl, int owningFlid, string &titleStr ) : bool
mdc IFwMetaDataCache
tbl SIL.Utils.StringTable
owningFlid int
titleStr string *{dstClass}* if couldn't find result.
Результат bool

TryFindString() публичный статический Метод

public static TryFindString ( SIL.Utils.StringTable tbl, string group, string key, string &result ) : bool
tbl SIL.Utils.StringTable
group string
key string
result string
Результат bool

TryMatchExistingAttributes() публичный статический Метод

go through possible attributes to match, and return true when the ones that exist match the same attributes in another node.
public static TryMatchExistingAttributes ( XmlNode colSpec1, XmlNode colSpec2, Queue &possibleAttributesToMatch ) : bool
colSpec1 System.Xml.XmlNode
colSpec2 System.Xml.XmlNode
possibleAttributesToMatch Queue the attributes to try to match, in the order we try to match them. /// if this routine returns true then this the top queue element will be the attribute we matched on.
Результат bool

Описание свойств

s_cwsMulti статическое защищенное свойство

static protected int s_cwsMulti
Результат int

s_fMultiFirst статическое защищенное свойство

static protected bool s_fMultiFirst
Результат bool

s_qwsCurrent статическое защищенное свойство

Current writing system id being used in multilingual fragment. Some methods that refer to this variable are static, so it must be static also. REVIEW (EberhardB/TimS): this probably won't work with different databases that have different default ws!
static protected IWritingSystem s_qwsCurrent
Результат IWritingSystem

s_sMultiSep статическое защищенное свойство

static protected string s_sMultiSep
Результат string