Interface ISegmentDocument
Data container used with ISegmentEditControl.
Inherited Members
Namespace: SdlSdl.DesktopEditorEditorApi
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 |
---|---|
IAbstractMarkupDataContainer |
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 NotifyContentUpdated() to re-generate document nodes from the content, reset the selection and update all edit controls. It is usually better to explicitly call methods like ReplaceWithContentOf(IAbstractMarkupDataContainer) or AppendText(string) to update the document content.
This container instance can also be explicitly set by calling ReplaceContentContainer(IAbstractMarkupDataContainer), to make the document operate directly on existing content.
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 |
---|---|---|
IAbstractMarkupDataContainer | 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 IAbstractMarkupData and it must not already be part of another container (i.e. its Parent
property must be |
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 NotifyContentUpdated() is called if that happens.
ReplaceWithContentOf(IAbstractMarkupDataContainer)ReplaceWithContentOf(IAbstractMarkupDataContainer)
Replace all content in the document.
Declaration
void ReplaceWithContentOf(IAbstractMarkupDataContainer newContent)
Parameters
Type | Name | Description |
---|---|---|
IAbstractMarkupDataContainer | 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 ReplaceContentContainer(IAbstractMarkupDataContainer) instead.
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.