/*************************************************************************
 *
 *  File Name (AccessibleEditableText.idl)
 * 
 *  IAccessible2 IDL Specification 
 * 
 *  Copyright (c) 2007, 2012 Linux Foundation 
 *  Copyright (c) 2006 IBM Corporation 
 *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 
 *  All rights reserved. 
 *   
 *   
 *  Redistribution and use in source and binary forms, with or without 
 *  modification, are permitted provided that the following conditions 
 *  are met: 
 *   
 *   1. Redistributions of source code must retain the above copyright 
 *      notice, this list of conditions and the following disclaimer. 
 *   
 *   2. Redistributions in binary form must reproduce the above 
 *      copyright notice, this list of conditions and the following 
 *      disclaimer in the documentation and/or other materials 
 *      provided with the distribution. 
 *
 *   3. Neither the name of the Linux Foundation nor the names of its 
 *      contributors may be used to endorse or promote products 
 *      derived from this software without specific prior written 
 *      permission. 
 *   
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
 *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
 *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
 *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
 *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
 *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
 *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
 *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 *   
 *  This BSD License conforms to the Open Source Initiative "Simplified 
 *  BSD License" as published at: 
 *  http://www.opensource.org/licenses/bsd-license.php 
 *   
 *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 
 *  mark may be used in accordance with the Linux Foundation Trademark 
 *  Policy to indicate compliance with the IAccessible2 specification. 
 * 
 ************************************************************************/ 

import "objidl.idl";
import "oaidl.idl";
import "oleacc.idl";
import "IA2CommonTypes.idl";

/** @brief This interface provides clipboard capability to text objects.

 This interface is typically used in conjunction with the IAccessibleText 
  interface and complements that interface with the additional capability of
  clipboard operations.  Note that even a read only text object can support
  the copy capability so this interface is not limited to editable objects.

 The substrings used with this interface are specified as follows:
  If startOffset is less than endOffset, the substring starts with the 
  character at startOffset and ends with the character just before endOffset.
  If endOffset is lower than startOffset,  the result is the same as a call 
  with the two arguments exchanged. The whole text can be defined by passing 
  the indices zero and IAccessibleText::nCharacters. If both indices have the 
  same value, an empty string is defined. 

 Refer to the @ref _specialOffsets
  "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 
  for information about a special offset constant that can be used in %IAccessibleEditableText methods.
*/
[object, uuid(A59AA09A-7011-4b65-939D-32B1FB5547E3)]
interface IAccessibleEditableText : IUnknown
{

  /** @brief Copies the text range into the clipboard.
    
   The selection is set to the specified offsets and then selection is copied into
   the system clipboard.
        
   @param [in] startOffset
    Start index of the text to moved into the clipboard.
    The valid range is 0..length.
   @param [in] endOffset
    End index of the text to moved into the clipboard.
    The valid range is 0..length.
   @retval S_OK
   @retval E_INVALIDARG if bad [in] passed
   @note Refer to @ref _specialOffsets 
    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 
    for information about special offsets that can be used in %IAccessibleEditableText
    methods.
   @deprecated This function is available via the application's GUI.
  */
  HRESULT copyText
    (
     [in] long startOffset, 
     [in] long endOffset 
    );

  /** @brief Deletes a range of text.
    
   The text between and including the two given indices is deleted
    from the text represented by this object.

   @param [in] startOffset
    Start index of the text to be deleted.
    The valid range is 0..length.
   @param [in] endOffset
    End index of the text to be deleted.
    The valid range is 0..length.
   @retval S_OK
   @retval E_INVALIDARG if bad [in] passed
   @note Refer to @ref _specialOffsets 
    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 
    for information about special offsets that can be used in %IAccessibleEditableText
    methods.
  */
  HRESULT deleteText
    (
     [in] long startOffset, 
     [in] long endOffset 
    );
  
  /** @brief Inserts text at the specified position.
    
   The specified string is inserted at the given index into the text
    represented by this object.

   @param [in] offset
    Index at which to insert the text.
    The valid range is 0..length.
	Refer to @ref _specialOffsets 
    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 
    for information about special offsets that can be used in %IAccessibleEditableText
    methods.
   @param [in] text
    Text that is inserted.
   @retval S_OK
   @retval E_INVALIDARG if bad [in] passed
  */
  HRESULT insertText
    (
     [in] long offset,
     [in] BSTR *text
    );
  
  /** @brief Deletes a range of text and copies it to the clipboard.
    
   The selection is set to the specified offsets, the selection is then copied into
    the system clipboard, and then the selection is deleted.

   @param [in] startOffset
    Start index of the text to be deleted.
    The valid range is 0..length.
   @param [in] endOffset 	
    End index of the text to be deleted.
    The valid range is 0..length.
   @retval S_OK
   @retval E_INVALIDARG if bad [in] passed
   @note Refer to @ref _specialOffsets 
    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 
    for information about special offsets that can be used in %IAccessibleEditableText
    methods.
   @deprecated This function is available via the application's GUI.
  */
  HRESULT cutText
    (
     [in] long startOffset,
     [in] long endOffset
    );

  /** @brief Pastes content from the clipboard.
    
   Any existing selection is removed, the clipboard content is then pasted into 
    this object's text at the given offset.  This method is similar to the insertText
    method.  If the index is not valid the system clipboard content is not inserted. The
    behavior is the same as	when Ctrl+V is used, i.e. the pasted contents are not
    necessarily plain text.
  
   @param [in] offset
    Index at which to insert the content from the system clipboard into
    the text represented by this object.
    The valid range is 0..length.
	Refer to @ref _specialOffsets 
    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 
    for information about special offsets that can be used in %IAccessibleEditableText
    methods.
   @retval S_OK
   @retval E_INVALIDARG if bad [in] passed
   @deprecated This function is available via the application's GUI.
  */
  HRESULT pasteText
    (
     [in] long offset
    );

  /** @brief Replaces text.
    
   The text between the two given indices is replaced by the specified 
    replacement string. This method is equivalent to calling first
    IAccessibleEditableText::deleteText with the two indices and then 
    calling IAccessibleEditableText::insertText with the replacement text
	at the start index.
       
   @param [in] startOffset
    Start index of the text to be replaced.
    The valid range is 0..length.
   @param [in] endOffset
    End index of the text to be replaced.
    The valid range is 0..length.
   @param [in] text
    The Text that replaces the text between the given indices.
   @retval S_OK
   @retval E_INVALIDARG if bad [in] passed
   @note Refer to @ref _specialOffsets 
    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 
    for information about special offsets that can be used in %IAccessibleEditableText
    methods.
  */
  HRESULT replaceText
    (
     [in] long startOffset,
     [in] long endOffset,
     [in] BSTR *text
    );

  /** @brief Replaces the attributes of a text range by the given set of attributes.
    
   Sets the attributes for the text between the two given indices. The old
    attributes are replaced by the new list of attributes.
        
   @param [in] startOffset
    Start index of the text whose attributes are modified.
    The valid range is 0..length.
   @param [in] endOffset
    End index of the text whose attributes are modified.
    The valid range is 0..length.
   @param [in] attributes
    Set of attributes that replaces the old list of attributes of
    the specified text portion.
   @retval S_OK
   @retval E_INVALIDARG if bad [in] passed
   @note Refer to @ref _specialOffsets 
    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 
    for information about special offsets that can be used in %IAccessibleEditableText
    methods.
  */
  HRESULT setAttributes
    (
     [in] long startOffset,
     [in] long endOffset,
     [in] BSTR *attributes
    );
}

