Interface IAbstractFrameworkDocument
Base interface for documents used by filter framework specific edit controls.
Inherited Members
Namespace: Sdl.DesktopEditor.EditorApi
Assembly: Sdl.DesktopEditor.EditorApi.dll
Syntax
public interface IAbstractFrameworkDocument : IDocument, IDisposable
Properties
DocumentProperties
The filter framework properties for the document.
Declaration
IDocumentProperties DocumentProperties { get; set; }
Property Value
Type | Description |
---|---|
IDocumentProperties |
ItemFactory
The factory used when new bilingual content items need to be created.
Declaration
IDocumentItemFactory ItemFactory { get; set; }
Property Value
Type | Description |
---|---|
IDocumentItemFactory |
PropertiesFactory
The factory used when new properties objects need to be created.
Declaration
IPropertiesFactory PropertiesFactory { get; }
Property Value
Type | Description |
---|---|
IPropertiesFactory |
Remarks
This is just a convenience getter that returns the PropertiesFactory of the ItemFactory property.
Methods
Copy()
Filter framework specific version of Copy() that returns a filter framework specific document fragment.
Declaration
IDocumentFragment Copy()
Returns
Type | Description |
---|---|
IDocumentFragment | A document fragment containing a changeable copy of the active range. |
Remarks
May throw Sdl.DesktopEditor.EditorApi.EditExeption
if the active range cannot
be copied (e.g. if it contains non-framework nodes or non-cloneable nodes such as Paragraph Units or files).
CopyInternal(Boolean)
Returns the document selection, allowing pre-extending it to include the revision marker.
Declaration
IDocumentFragment CopyInternal(bool extendSelectionToIncludeRevision)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | extendSelectionToIncludeRevision |
Returns
Type | Description |
---|---|
IDocumentFragment |
CreateDocumentFragment()
Creates a new empty document fragment that can be used to insert content using e.g. the Replace(IDocumentFragment) method.
Declaration
IDocumentFragment CreateDocumentFragment()
Returns
Type | Description |
---|---|
IDocumentFragment | A new empty document fragment. |
GetMarkupDataRanges(ContentRange)
Use this method to find all non-empty sub-ranges for a range where each sub-range spans only markup data nodes with a common parent.
Declaration
List<ContentRange> GetMarkupDataRanges(ContentRange range)
Parameters
Type | Name | Description |
---|---|---|
ContentRange | range | The range which the sub-ranges will be limited to. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<ContentRange> | A list with 0 or more sub-ranges where for each sub-range all content nodes are markup data nodes that have the same parent node. |
Remarks
For example, this is used when applying a QuickTag or comment across multiple segments or tag pairs, where the main range may start in one container and end in another. Simply call this method for the main range and then apply the QuickTag (or comment) to each of the sub-ranges returned.
void ApplyQuickTag(IFrameworkDocument document, ContentRange range, IQuickTag quickTag)
{
foreach (ContentRange subRange in document.GetMarkupDataRanges(range))
{
document.ActiveRange = subRange;
document.ApplyQuickTagToActiveRange(quickTag);
}
}
Note that you would typically want to group such operations into a single Undo command, e.g. by calling BeginCompositeOperation(String) and EndCompositeOperation(). One way to access the undo buffer is through UndoBuffer.
GetNearestPosition(IMessageLocation)
Returns a position that is nearest to what the message location references,
or null
if no location could be determined.
Declaration
Position GetNearestPosition(IMessageLocation messageLocation)
Parameters
Type | Name | Description |
---|---|---|
IMessageLocation | messageLocation | The message location that the document position is required for. |
Returns
Type | Description |
---|---|
Position | The nearest position that relates to the message location. |
Remarks
If the location cannot be directly mapped (e.g. if the corresponding node is no longer available in the editor) the implementation will attempt to guess the position based on other available information.
InsertSegment(ISegmentPairProperties, ISegmentContainerNode)
Insert new empty segment after specified segment.
Declaration
void InsertSegment(ISegmentPairProperties segmentPairProperties, ISegmentContainerNode afterSegment)
Parameters
Type | Name | Description |
---|---|---|
ISegmentPairProperties | segmentPairProperties | Properties for the new segment pair, they must not use the same segment ID as any existing segment in the paragraph. |
ISegmentContainerNode | afterSegment | New segment will be inserted after this segment. |
MergeIdenticalNeighboringTags(ContentRange)
Finds tag pairs in the specified range that are adjacent to each other and are the same. Under these circumstances, the tag pairs can be merged. This is useful when cleaning up segments before updating the TM, for example.
Declaration
void MergeIdenticalNeighboringTags(ContentRange range)
Parameters
Type | Name | Description |
---|---|---|
ContentRange | range | The range to limit the operation to. |
Replace(IDocumentFragment)
Replace the content in the active range with the content of a filter framework specific document fragment.
Declaration
void Replace(IDocumentFragment newContent)
Parameters
Type | Name | Description |
---|---|---|
IDocumentFragment | newContent | The document fragment containing the content to replace in the active range. |
RestoreGhostTags()
Restores any tags in the document's active range, converting them from ghost tags to normal tags.
Declaration
void RestoreGhostTags()
Events
ContentChanged
Fired when content in the document is changed in any way. Contains information about the exact changes made to the document.
Declaration
event EventHandler<FrameworkDocumentContentChangedEventArgs> ContentChanged
Event Type
Type | Description |
---|---|
System.EventHandler<FrameworkDocumentContentChangedEventArgs> |
Remarks
This event hides the ContentChanged event, it contains the same information plus the list of edit operations that were executed on the document. These could be used to determine the affected content more precisely than would be possible with the affected range only.
This event is typcially fired immediately when the content is changed, which can be before the controls displaying the content have been updated.