Search Results for

    Show / Hide Table of Contents

    Class Document

    Contains the document implementation

    Inheritance
    object
    Document
    Implements
    IStudioDocument
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    Namespace: Sdl.TranslationStudioAutomation.IntegrationApi
    Assembly: Sdl.TranslationStudioAutomation.IntegrationApi.dll
    Syntax
    public sealed class Document : IStudioDocument

    Properties

    ActiveFile

    Gets the active project file.

    Declaration
    public ProjectFile ActiveFile { get; }
    Property Value
    Type Description
    ProjectFile

    ActiveFileProperties

    Gets the active file properties

    Declaration
    public IFileProperties ActiveFileProperties { get; }
    Property Value
    Type Description
    IFileProperties

    ActiveSegmentPair

    Gets the active segment pair.

    Declaration
    public ISegmentPair ActiveSegmentPair { get; }
    Property Value
    Type Description
    ISegmentPair

    DisplayFilter

    Get the active Display Filter

    The result will be null if the filter that has been applied on the document is derived from the internal provider. This should permit the developer to differentiate between the internal system filter provider and their own implementation and/or multiple implementations of the interface.

    Declaration
    public IDisplayFilter DisplayFilter { get; }
    Property Value
    Type Description
    IDisplayFilter

    Files

    Get the files of the document

    Declaration
    public IEnumerable<ProjectFile> Files { get; }
    Property Value
    Type Description
    IEnumerable<ProjectFile>

    FilteredSegmentPairs

    Get the filtered document segment pairs in a readonly mode

    Declaration
    public IEnumerable<ISegmentPair> FilteredSegmentPairs { get; }
    Property Value
    Type Description
    IEnumerable<ISegmentPair>

    FilteredSegmentPairsCount

    The filtered document segment pairs count

    Declaration
    public int FilteredSegmentPairsCount { get; }
    Property Value
    Type Description
    int

    FocusedDocumentContent

    Gets the focus document content

    Declaration
    public FocusedDocumentContent FocusedDocumentContent { get; }
    Property Value
    Type Description
    FocusedDocumentContent

    IsDirty

    Returns true if the document has unsaved changes.

    Declaration
    public bool IsDirty { get; }
    Property Value
    Type Description
    bool

    IsTranslationProviderAvailable

    Get a boolean value that indicate if a Translation Provider is available.

    Declaration
    public bool IsTranslationProviderAvailable { get; }
    Property Value
    Type Description
    bool

    ItemFactory

    Gets the factory for the document items

    Declaration
    public IDocumentItemFactory ItemFactory { get; }
    Property Value
    Type Description
    IDocumentItemFactory

    Mode

    Gets the editing mode of the document

    Declaration
    public EditingMode Mode { get; }
    Property Value
    Type Description
    EditingMode

    Project

    Gets the project of the document

    Declaration
    public FileBasedProject Project { get; }
    Property Value
    Type Description
    FileBasedProject

    PropertiesFactory

    Gets the factory for the item properties

    Declaration
    public IPropertiesFactory PropertiesFactory { get; }
    Property Value
    Type Description
    IPropertiesFactory

    SegmentPairs

    Get the document segment pairs in a readonly mode

    Declaration
    public IEnumerable<ISegmentPair> SegmentPairs { get; }
    Property Value
    Type Description
    IEnumerable<ISegmentPair>

    Selection

    Gets the document selection

    Declaration
    public DocumentSelection Selection { get; }
    Property Value
    Type Description
    DocumentSelection

    The document selection.

    TotalSegmentPairsCount

    The total document segment pairs count

    Declaration
    public int TotalSegmentPairsCount { get; }
    Property Value
    Type Description
    int

    Methods

    AcceptAllTrackedChanges(ConfirmationLevel)

    Accepts all tracked changes and change the confirmation level if the new confirmation level is not Undefined

    Declaration
    public void AcceptAllTrackedChanges(ConfirmationLevel newConfirmationLevel)
    Parameters
    Type Name Description
    ConfirmationLevel newConfirmationLevel

    New confirmation level

    AddCommentOnSegment(ISegmentPair, string, Severity)

    Adds a comment to the target segment

    Declaration
    public void AddCommentOnSegment(ISegmentPair segmentPair, string text, Severity severity)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Segment

    string text

    Comment text

    Severity severity

    Comment severity level

    AddCommentOnTargetSelection(string, Severity)

    Adds a comment to the selected content range in the target document.

    Declaration
    public void AddCommentOnTargetSelection(string text, Severity severity)
    Parameters
    Type Name Description
    string text

    Comment text

    Severity severity

    Comment severity level

    ApplyFilterOnSegments(IDisplayFilter)

    Apply filter on the segments from the active document in the editor

    Declaration
    public void ApplyFilterOnSegments(IDisplayFilter filter)
    Parameters
    Type Name Description
    IDisplayFilter filter

    The implementation of the display filter interface

    ChangeConfirmationLevelOnSegment(ISegmentPair, ConfirmationLevel)

    Sets the segment confirmation level to the specified value

    Declaration
    public void ChangeConfirmationLevelOnSegment(ISegmentPair segmentPair, ConfirmationLevel newConfirmationLevel)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Segment

    ConfirmationLevel newConfirmationLevel

    The new confirmation level for the segment.

    ChangeTranslationOriginOnSegment(ISegmentPair, string)

    Sets the translation origin for the specified segment to the specified origin type

    Declaration
    public void ChangeTranslationOriginOnSegment(ISegmentPair segmentPair, string originType)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Segment

    string originType

    The translation origin type. This should normally be one of the constants define in DefaultTranslationOrigin.

    DeleteAllCommentsOnSegment(ISegmentPair)

    Delete all comments from the target segment.

    Declaration
    public void DeleteAllCommentsOnSegment(ISegmentPair segmentPair)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Segment

    DeleteAllCommentsWithoutNotification()

    Delete all comments from active document and saves the document.

    Declaration
    public void DeleteAllCommentsWithoutNotification()

    DeleteCommentOnSegment(ISegmentPair, IComment)

    Delete a specific comment from the target segment.

    Declaration
    public void DeleteCommentOnSegment(ISegmentPair segmentPair, IComment commentToDelete)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Segment

    IComment commentToDelete

    Comment to be deleted

    FindTextInSegment(string, string, bool, bool)

    Finds a given text in the given segment

    Declaration
    public bool FindTextInSegment(string segmentNumber, string text, bool highlightText, bool searchInSource)
    Parameters
    Type Name Description
    string segmentNumber
    string text

    Text to be found

    bool highlightText

    if this is set to true, the found text is selected in the segment

    bool searchInSource

    True if we want to find the text in the source

    Returns
    Type Description
    bool

    True - if the text was found

    GetActiveSegmentPair()

    Get the active segment pair in a readonly mode.

    Declaration
    public ISegmentPair GetActiveSegmentPair()
    Returns
    Type Description
    ISegmentPair

    The active segment pair or null if none was found.

    GetCommentsFromSegment(ISegmentPair)

    Obtain all comments existing from the target segment

    Declaration
    public IEnumerable<IComment> GetCommentsFromSegment(ISegmentPair segmentPair)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Segment

    Returns
    Type Description
    IEnumerable<IComment>

    A list of comments from the target segment

    GetParentParagraphUnit(ISegmentPair)

    Declaration
    public IParagraphUnit GetParentParagraphUnit(ISegmentPair segmentPair)
    Parameters
    Type Name Description
    ISegmentPair segmentPair
    Returns
    Type Description
    IParagraphUnit

    GetSegmentPair(int)

    Get the segment pair from the row number

    Declaration
    public ISegmentPair GetSegmentPair(int rowNumber)
    Parameters
    Type Name Description
    int rowNumber

    The row number

    Returns
    Type Description
    ISegmentPair

    The segment pair or null if none was found.

    GetSegmentPair(string, string)

    Get the segment pair from the paragraph and segment id

    Declaration
    public ISegmentPair GetSegmentPair(string paragraphUnitId, string segmentId)
    Parameters
    Type Name Description
    string paragraphUnitId

    The paragraph unit id

    string segmentId

    The segment id

    Returns
    Type Description
    ISegmentPair

    The segment pair or null if none was found.

    GetSegmentPairsFromParagraph(ParagraphUnitId)

    Get the segment pairs from a specific paragraph

    Declaration
    public IEnumerable<ISegmentPair> GetSegmentPairsFromParagraph(ParagraphUnitId paragraphId)
    Parameters
    Type Name Description
    ParagraphUnitId paragraphId

    Paragraph unique identifier

    Returns
    Type Description
    IEnumerable<ISegmentPair>

    A list of segment pairs from the provided paragraph

    GetSelectedSegmentPairs()

    Obtain all selected segment pairs

    Declaration
    public IEnumerable<ISegmentPair> GetSelectedSegmentPairs()
    Returns
    Type Description
    IEnumerable<ISegmentPair>

    A list of selected segment pairs from the editor

    ProcessSegmentPair(ISegmentPair, string, Action<ISegmentPair, CancelEventArgs>)

    Processing a single specific segment pair with the ability to alter the source and/or target

    Declaration
    public void ProcessSegmentPair(ISegmentPair segmentPair, string processingName, Action<ISegmentPair, CancelEventArgs> process)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Segment Pair

    string processingName

    A custom provided name for the processing operation used for the undo history.

    Action<ISegmentPair, CancelEventArgs> process

    Processing delegate responsable for analyzing the segment pair.

    Remarks

    Even if the source is configured to be in the editable mode this will not be functional if the document does not allow it.

    ProcessSegmentPairs(string, Action<ISegmentPair, CancelEventArgs>)

    Processing the document segment pairs with the ability to alter the source and/or target

    Declaration
    public void ProcessSegmentPairs(string processingName, Action<ISegmentPair, CancelEventArgs> process)
    Parameters
    Type Name Description
    string processingName

    A custom provided name for the processing operation used for the undo history.

    Action<ISegmentPair, CancelEventArgs> process

    Processing delegate responsable for analyzing the segment pairs.

    Remarks

    Even if the source is configured to be in the editable mode this will not be functional if the document does not allow it.

    SelectedSegmentsContainRevisions()

    Checks if the selected segments on Target contains Revisions or TQA

    Declaration
    public bool SelectedSegmentsContainRevisions()
    Returns
    Type Description
    bool

    SetActiveSegmentPair(ProjectFile, string, bool)

    Sets the active segment pair to the segment pair with the given number and sets focus on that segment if specified.

    Declaration
    public bool SetActiveSegmentPair(ProjectFile projectFile, string segmentNumber, bool setFocusOnSegment = false)
    Parameters
    Type Name Description
    ProjectFile projectFile

    For normal document it is opened from one file and for virtual document it is opened from multiple files. When the document is virtual the projetFile indicates the refered file, which can be obtained from Files properpty of Document. For normal document, this parameter is ignored.

    string segmentNumber

    The segment number.

    bool setFocusOnSegment

    Set this to true if focus should be set to the segment

    Returns
    Type Description
    bool

    True if the segment pair was activated successfully. This may be false if no such segment exists or if the segment is currently filtered out from view.>

    SetActiveSegmentPair(string, string, bool)

    Sets the active segment pair to the segment pair with the given paragraphId and segmentNumber.

    Declaration
    public bool SetActiveSegmentPair(string paragraphId, string segmentNumber, bool setFocusOnSegment = false)
    Parameters
    Type Name Description
    string paragraphId
    string segmentNumber
    bool setFocusOnSegment

    Set this to true if focus should be set to the segment

    Returns
    Type Description
    bool

    TryTranslateActiveSegment()

    Tries to initiate the translation process for the active segment.

    Declaration
    public void TryTranslateActiveSegment()
    Remarks

    If the project does not have any Translation Provider set, the translation of the active segment will not work.

    UpdateCommentOnSegment(ISegmentPair, IComment, string, Severity)

    Update a comment text and severity on the target segment

    Declaration
    public void UpdateCommentOnSegment(ISegmentPair segmentPair, IComment commentToUpdate, string text, Severity severity)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Segment

    IComment commentToUpdate

    Comment to be updated

    string text

    New coment text

    Severity severity

    New coment severity level

    UpdateParagraphUnitProperties(IParagraphUnitProperties)

    Directly update the properties of a paragraph unit

    Declaration
    public void UpdateParagraphUnitProperties(IParagraphUnitProperties paragraphUnitProperties)
    Parameters
    Type Name Description
    IParagraphUnitProperties paragraphUnitProperties

    Updated properties for the paragraph unit

    UpdateSegmentPair(ISegmentPair)

    Directly update a segment pair in the document

    Declaration
    public void UpdateSegmentPair(ISegmentPair segmentPair)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Updated segment pair

    UpdateSegmentPairProperties(ISegmentPair, ISegmentPairProperties)

    Directly update the properties of a segment pair, without processing the whole segment pair

    Declaration
    public void UpdateSegmentPairProperties(ISegmentPair segmentPair, ISegmentPairProperties segmentPairProperties)
    Parameters
    Type Name Description
    ISegmentPair segmentPair

    Segment

    ISegmentPairProperties segmentPairProperties

    Updated properties for the segment pair

    Events

    ActiveFileChanged

    Triggered when the active file is changed.

    Declaration
    public event EventHandler ActiveFileChanged
    Event Type
    Type Description
    EventHandler

    ActiveFilePropertiesChanged

    Triggered when the properties of the active file are changed

    Declaration
    public event EventHandler ActiveFilePropertiesChanged
    Event Type
    Type Description
    EventHandler

    ActiveSegmentChanged

    Triggered when the active segment is changed.

    Declaration
    public event EventHandler ActiveSegmentChanged
    Event Type
    Type Description
    EventHandler

    ActiveSegmentContentIsReady

    The event is triggered when the content for the active segment is ready and it can be modified by a third party application.

    Declaration
    public event EventHandler ActiveSegmentContentIsReady
    Event Type
    Type Description
    EventHandler

    ContentChanged

    Triggered when document content is changed.

    Declaration
    public event EventHandler<DocumentContentEventArgs> ContentChanged
    Event Type
    Type Description
    EventHandler<DocumentContentEventArgs>

    DocumentFilterChanged

    Triggered when the document filter has changed.

    Declaration
    public event EventHandler<DocumentFilterEventArgs> DocumentFilterChanged
    Event Type
    Type Description
    EventHandler<DocumentFilterEventArgs>

    SegmentTranslated

    Triggered after a segment has been translated.

    Declaration
    public event EventHandler SegmentTranslated
    Event Type
    Type Description
    EventHandler

    SegmentsConfirmationLevelChanged

    The event is triggered when a ConfirmationLevel is changed for a Segment.

    Declaration
    public event EventHandler SegmentsConfirmationLevelChanged
    Event Type
    Type Description
    EventHandler

    SegmentsTranslationOriginChanged

    The event is triggered when a TranslationOrigin is changed for a Segment.

    Declaration
    public event EventHandler SegmentsTranslationOriginChanged
    Event Type
    Type Description
    EventHandler

    Implements

    IStudioDocument

    Extension Methods

    WindowsControlUtils.ForWindowFromFrameworkElement(object, Action<Window>)
    In this article
    • Properties
      • ActiveFile
      • ActiveFileProperties
      • ActiveSegmentPair
      • DisplayFilter
      • Files
      • FilteredSegmentPairs
      • FilteredSegmentPairsCount
      • FocusedDocumentContent
      • IsDirty
      • IsTranslationProviderAvailable
      • ItemFactory
      • Mode
      • Project
      • PropertiesFactory
      • SegmentPairs
      • Selection
      • TotalSegmentPairsCount
    • Methods
      • AcceptAllTrackedChanges(ConfirmationLevel)
      • AddCommentOnSegment(ISegmentPair, string, Severity)
      • AddCommentOnTargetSelection(string, Severity)
      • ApplyFilterOnSegments(IDisplayFilter)
      • ChangeConfirmationLevelOnSegment(ISegmentPair, ConfirmationLevel)
      • ChangeTranslationOriginOnSegment(ISegmentPair, string)
      • DeleteAllCommentsOnSegment(ISegmentPair)
      • DeleteAllCommentsWithoutNotification()
      • DeleteCommentOnSegment(ISegmentPair, IComment)
      • FindTextInSegment(string, string, bool, bool)
      • GetActiveSegmentPair()
      • GetCommentsFromSegment(ISegmentPair)
      • GetParentParagraphUnit(ISegmentPair)
      • GetSegmentPair(int)
      • GetSegmentPair(string, string)
      • GetSegmentPairsFromParagraph(ParagraphUnitId)
      • GetSelectedSegmentPairs()
      • ProcessSegmentPair(ISegmentPair, string, Action<ISegmentPair, CancelEventArgs>)
      • ProcessSegmentPairs(string, Action<ISegmentPair, CancelEventArgs>)
      • SelectedSegmentsContainRevisions()
      • SetActiveSegmentPair(ProjectFile, string, bool)
      • SetActiveSegmentPair(string, string, bool)
      • TryTranslateActiveSegment()
      • UpdateCommentOnSegment(ISegmentPair, IComment, string, Severity)
      • UpdateParagraphUnitProperties(IParagraphUnitProperties)
      • UpdateSegmentPair(ISegmentPair)
      • UpdateSegmentPairProperties(ISegmentPair, ISegmentPairProperties)
    • Events
      • ActiveFileChanged
      • ActiveFilePropertiesChanged
      • ActiveSegmentChanged
      • ActiveSegmentContentIsReady
      • ContentChanged
      • DocumentFilterChanged
      • SegmentTranslated
      • SegmentsConfirmationLevelChanged
      • SegmentsTranslationOriginChanged
    • Implements
    • Extension Methods
    Back to top Generated by DocFX