|
//-----------------------------------------------------------------------
//
// Microsoft Windows Client Platform
// Copyright (C) Microsoft Corporation, 2004
//
// File: TextCollapsingProperties.cs
//
// Contents: Definition of text collapsing properties and related types
//
// Spec: http://team/sites/Avalon/Specs/Text%20Formatting%20API.doc
//
// Created: 1-2-2004 Worachai Chaoweeraprasit (wchao)
//
//------------------------------------------------------------------------
using System;
using System.Collections;
using System.Windows;
namespace System.Windows.Media.TextFormatting
{
/// <summary>
/// Properties of text collapsing
/// </summary>
public abstract class TextCollapsingProperties
{
/// <summary>
/// TextFormatter to get width in which specified collapsible range constrained to
/// </summary>
public abstract double Width
{ get; }
/// <summary>
/// TextFormatter to get text run used as collapsing symbol
/// </summary>
public abstract TextRun Symbol
{ get; }
/// <summary>
/// TextFormatter to get style of collapsing
/// </summary>
public abstract TextCollapsingStyle Style
{ get; }
}
/// <summary>
/// Range of characters and its width measurement where collapsing has happened within a line
/// </summary>
public sealed class TextCollapsedRange
{
private int _cp;
private int _length;
private double _width;
/// <summary>
/// Construct a collapsed range
/// </summary>
/// <param name="cp">first character collapsed</param>
/// <param name="length">number of characters collapsed</param>
/// <param name="width">total width of collapsed characters</param>
internal TextCollapsedRange(
int cp,
int length,
double width
)
{
_cp = cp;
_length = length;
_width = width;
}
/// <summary>
/// text source character index to the first character in range that is collapsed
/// </summary>
public int TextSourceCharacterIndex
{
get { return _cp; }
}
/// <summary>
/// number of characters collapsed
/// </summary>
public int Length
{
get { return _length; }
}
/// <summary>
/// total width of collapsed character range
/// </summary>
public double Width
{
get { return _width; }
}
}
/// <summary>
/// Text collapsing style
/// </summary>
public enum TextCollapsingStyle
{
/// <summary>
/// Collapse trailing characters
/// </summary>
TrailingCharacter,
/// <summary>
/// Collapse trailing words
/// </summary>
TrailingWord,
}
}
|