Interface ISegmentDocument
Data container used with ISegment
Inherited Members
Namespace: Sdl.DesktopEditor.EditorApi
Assembly: Sdl.DesktopEditor.EditorApi.dll
Syntax
public interface ISegmentDocument : IAbstractFrameworkDocument, IDocument, IDisposable
Properties
Content
The markup data content this document represents, typically a single segment.
Declaration
IAbstractMarkupDataContainer Content { get; }
Property Value
Type | Description |
---|---|
IAbstract |
Remarks
It is not recommended to change content in the container by directly accessing markup data items from this property.
If the content does change you must explicitly call Notify
This container instance can also be explicitly set by calling Replace
Language
The language of the content in the document. This is used by the edit control to determine right-to-left alignment and may affect the fonts used in the control.
Declaration
Language Language { get; set; }
Property Value
Type | Description |
---|---|
Language |
Methods
AppendText(String)
Handy shortcut to append a literal text string to the current content of the document.
Declaration
void AppendText(string text)
Parameters
Type | Name | Description |
---|---|---|
String | text | The text to append to the current document content. |
Remarks
Any associated edit controls are automatically updated.
Clear()
Remove all content from the document.
Declaration
void Clear()
Remarks
This will cause the undo buffer and the active range to be reset and all text marks to be cleared.
Any associated edit controls are automatically updated.
NotifyContentUpdated()
Notify the segment document implementation that Content has been changed (other than through a call to another method in this interface).
Declaration
void NotifyContentUpdated()
Remarks
Calling this method will cause all document content nodes to be re-generated from the markup data in the Content. The active range, the undo-buffer, and all text marks will be cleared and reset in the same way as if any of the other Replace methods had been called.
ReplaceContentContainer(IAbstractMarkupDataContainer)
Replace the current Content of the document with a different container.
Declaration
void ReplaceContentContainer(IAbstractMarkupDataContainer newContainer)
Parameters
Type | Name | Description |
---|---|---|
IAbstract |
newContainer | The markup data container that will become the new Content
of the segment document. This must be a container that can be inserted inside a paragraph unit. Thus it must
implement IAbstract |
Remarks
This will cause the undo buffer and the active range to be reset, all text marks will be cleared, and all document nodes will be re-generated. Any associated edit controls are automatically updated.
Note that all document nodes will be re-generated to reference the nodes in the specified
container rather than clones. This means that the edit control will from now on operate
directly on the container and its content. It is therefore important that no changes are made
to the container or its content without going through the edit control, or that Notify
ReplaceWithContentOf(IAbstractMarkupDataContainer)
Replace all content in the document.
Declaration
void ReplaceWithContentOf(IAbstractMarkupDataContainer newContent)
Parameters
Type | Name | Description |
---|---|---|
IAbstract |
newContent | Each item in this container will be duplicated into the document. The result can later be accessed through the Content property, but should not be modified directly. |
Remarks
This will cause the undo buffer and the active range to be reset, all text marks will be cleared, and all document nodes will be re-generated. Any associated edit controls are automatically updated.
Note that only the nodes inside the container will be cloned to become the new content,
the actual container will not. To replace the entire container (and not clone the content
nodes), call Replace
ReplaceWithText(String)
Replace the current content in the document with a single string of text.
Declaration
void ReplaceWithText(string newText)
Parameters
Type | Name | Description |
---|---|---|
String | newText | The text to show in the control. |
Remarks
This will cause the undo buffer and the active range to be reset, all text marks will be cleared, and all document nodes will be re-generated. Any associated edit controls are automatically updated.