Back to index

lightning-sunbird  0.9+nobinonly
nsIAccessibleText.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is the Mozilla browser.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Paul Sandoz (paul.sandoz@sun.com)
00025  *   Bill Haneman (bill.haneman@sun.com)
00026  *   John Gaunt (jgaunt@netscape.com)
00027  *
00028  * Alternatively, the contents of this file may be used under the terms of
00029  * either of the GNU General Public License Version 2 or later (the "GPL"),
00030  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00031  * in which case the provisions of the GPL or the LGPL are applicable instead
00032  * of those above. If you wish to allow use of your version of this file only
00033  * under the terms of either the GPL or the LGPL, and not to allow others to
00034  * use your version of this file under the terms of the MPL, indicate your
00035  * decision by deleting the provisions above and replace them with the notice
00036  * and other provisions required by the GPL or the LGPL. If you do not delete
00037  * the provisions above, a recipient may use your version of this file under
00038  * the terms of any one of the MPL, the GPL or the LGPL.
00039  *
00040  * ***** END LICENSE BLOCK ***** */
00041 
00042 #include "nsISupports.idl"
00043 
00044 typedef long nsAccessibleTextBoundary;
00045 typedef long nsAccessibleCoordType;
00046 
00047 [scriptable, uuid(E44D3FA6-9CB2-432A-8BDB-69D72B6ADA00)]
00048 interface nsIAccessibleText : nsISupports
00049 {
00050   const nsAccessibleTextBoundary BOUNDARY_CHAR = 0;
00051   const nsAccessibleTextBoundary BOUNDARY_WORD_START = 1;
00052   const nsAccessibleTextBoundary BOUNDARY_WORD_END = 2;
00053   const nsAccessibleTextBoundary BOUNDARY_SENTENCE_START = 3;
00054   const nsAccessibleTextBoundary BOUNDARY_SENTENCE_END = 4;
00055   const nsAccessibleTextBoundary BOUNDARY_LINE_START = 5;
00056   const nsAccessibleTextBoundary BOUNDARY_LINE_END = 6;
00057   const nsAccessibleTextBoundary BOUNDARY_ATTRIBUTE_RANGE = 7;
00058 
00059   const nsAccessibleCoordType COORD_TYPE_SCREEN = 0;
00060   const nsAccessibleCoordType COORD_TYPE_WINDOW = 1;
00061 
00062   attribute long caretOffset;
00063 
00064   readonly attribute long characterCount;
00065   readonly attribute long selectionCount;
00066 
00073   AString getText (in long startOffset, in long endOffset);
00074 
00075   AString getTextAfterOffset (in long offset,
00076                               in nsAccessibleTextBoundary boundaryType,
00077                               out long startOffset,
00078                               out long endOffset);
00079 
00080   AString getTextAtOffset (in long offset,
00081                            in nsAccessibleTextBoundary boundaryType,
00082                            out long startOffset,
00083                            out long endOffset);
00084 
00085   AString getTextBeforeOffset (in long offset,
00086                                in nsAccessibleTextBoundary boundaryType,
00087                                out long startOffset,
00088                                out long endOffset);
00089 
00094   wchar getCharacterAtOffset (in long offset);
00095 
00096   nsISupports getAttributeRange (in long offset,
00097                                  out long rangeStartOffset,
00098                                  out long rangeEndOffset);
00099 
00100   void getCharacterExtents (in long offset,
00101                             out long x,
00102                             out long y,
00103                             out long width,
00104                             out long height,
00105                             in nsAccessibleCoordType coordType);
00106 
00107   long getOffsetAtPoint (in long x, in long y,
00108                          in nsAccessibleCoordType coordType);
00109 
00110   void getSelectionBounds (in long selectionNum,
00111                            out long startOffset,
00112                            out long endOffset);
00113 
00114   void setSelectionBounds (in long selectionNum,
00115                               in long startOffset,
00116                               in long endOffset);
00117 
00118   void addSelection (in long startOffset, in long endOffset);
00119 
00120   void removeSelection (in long selectionNum);
00121 };
00122 
00123 /*
00124  Assumptions:
00125 
00126  Using wstring (UCS2) instead of string encoded in UTF-8.
00127  Multibyte encodings (or at least potentially multi-byte
00128  encodings) would be preferred for the reasons cited above.
00129 
00130  The following methods will throw an exception on failure
00131  (since not every text component will allow every operation):
00132  setSelectionBounds, addSelection, removeSelection, setCaretOffset.
00133 
00134  getRangeAttributes defined to return an nsISupports
00135  interface instead of a pango specific data structure.
00136  It may be that some other return type is more appropriate
00137  for mozilla text attributes.
00138 
00139  we assume that all text components support the idea of
00140  a caret offset, whether visible or "virtual".  If this
00141  isn't the case, caretOffset can be made readonly and
00142  a setCaretOffset method provided which throws an exception
00143  on failure (as with *selection methods above).
00144 */