mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 16:46:26 +00:00
bd48d7a92d
second step: other files
132 lines
4.9 KiB
Plaintext
132 lines
4.9 KiB
Plaintext
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* The contents of this file are subject to the Mozilla Public
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.mozilla.org/MPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
* implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The Original Code is the Mozilla browser.
|
|
*
|
|
* The Initial Developer of the Original Code is Netscape
|
|
* Communications Corporation. Portions created by Netscape are
|
|
* Copyright (C) 1999 Netscape Communications Corporation. All
|
|
* Rights Reserved.
|
|
*
|
|
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
|
|
*
|
|
* Contributor(s): Paul Sandoz (paul.sandoz@sun.com)
|
|
* Bill Haneman (bill.haneman@sun.com)
|
|
* John Gaunt (jgaunt@netscape.com)
|
|
*/
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
typedef long nsAccessibleTextBoundary;
|
|
typedef long nsAccessibleCoordType;
|
|
|
|
[scriptable, uuid(E44D3FA6-9CB2-432A-8BDB-69D72B6ADA00)]
|
|
interface nsIAccessibleText : nsISupports
|
|
{
|
|
const nsAccessibleTextBoundary BOUNDARY_CHAR = 0;
|
|
const nsAccessibleTextBoundary BOUNDARY_WORD_START = 1;
|
|
const nsAccessibleTextBoundary BOUNDARY_WORD_END = 2;
|
|
const nsAccessibleTextBoundary BOUNDARY_SENTENCE_START = 3;
|
|
const nsAccessibleTextBoundary BOUNDARY_SENTENCE_END = 4;
|
|
const nsAccessibleTextBoundary BOUNDARY_LINE_START = 5;
|
|
const nsAccessibleTextBoundary BOUNDARY_LINE_END = 6;
|
|
const nsAccessibleTextBoundary BOUNDARY_ATTRIBUTE_RANGE = 7;
|
|
|
|
const nsAccessibleCoordType COORD_TYPE_SCREEN = 0;
|
|
const nsAccessibleCoordType COORD_TYPE_WINDOW = 1;
|
|
|
|
attribute long caretOffset;
|
|
|
|
readonly attribute long characterCount;
|
|
readonly attribute long selectionCount;
|
|
|
|
/**
|
|
* String methods may need to return multibyte-encoded strings,
|
|
* since some locales can't be encoded using 16-bit chars.
|
|
* So the methods below might return UTF-16 strings, or they could
|
|
* return "string" values which are UTF-8.
|
|
*/
|
|
AString getText (in long startOffset, in long endOffset);
|
|
|
|
AString getTextAfterOffset (in long offset,
|
|
in nsAccessibleTextBoundary boundaryType,
|
|
out long startOffset,
|
|
out long endOffset);
|
|
|
|
AString getTextAtOffset (in long offset,
|
|
in nsAccessibleTextBoundary boundaryType,
|
|
out long startOffset,
|
|
out long endOffset);
|
|
|
|
/**
|
|
* It would be better to return an unsigned long here,
|
|
* to allow unicode chars > 16 bits
|
|
*/
|
|
wchar getCharacterAtOffset (in long offset);
|
|
|
|
nsISupports getAttributeRange (in long offset,
|
|
out long rangeStartOffset,
|
|
out long rangeEndOffset);
|
|
|
|
AString getTextBeforeOffset (in long offset,
|
|
in nsAccessibleTextBoundary boundaryType,
|
|
out long startOffset,
|
|
out long endOffset);
|
|
|
|
void getCharacterExtents (in long offset,
|
|
out long x,
|
|
out long y,
|
|
out long length,
|
|
out long width,
|
|
in nsAccessibleCoordType coordType);
|
|
|
|
long getOffsetAtPoint (in long x, in long y,
|
|
in nsAccessibleCoordType coordType);
|
|
|
|
void getSelectionBounds (in long selectionNum,
|
|
out long startOffset,
|
|
out long endOffset);
|
|
|
|
void setSelectionBounds (in long selectionNum,
|
|
in long startOffset,
|
|
in long endOffset);
|
|
|
|
void addSelection (in long startOffset, in long endOffset);
|
|
|
|
void removeSelection (in long selectionNum);
|
|
};
|
|
|
|
/*
|
|
Assumptions:
|
|
|
|
Using wstring (UCS2) instead of string encoded in UTF-8.
|
|
Multibyte encodings (or at least potentially multi-byte
|
|
encodings) would be preferred for the reasons cited above.
|
|
|
|
The following methods will throw an exception
|
|
on failure (since not every text component will allow
|
|
every operation):
|
|
setSelectionBounds, addSelection, removeSelection,
|
|
setCaretOffset.
|
|
|
|
getRangeAttributes defined to return an nsISupports
|
|
interface instead of a pango specific data structure.
|
|
It may be that some other return type is more appropriate
|
|
for mozilla text attributes.
|
|
|
|
we assume that all text components support the idea of
|
|
a caret offset, whether visible or "virtual". If this
|
|
isn't the case, caretOffset can be made readonly and
|
|
a setCaretOffset method provided which throws an exception
|
|
on failure (as with *selection methods above).
|
|
*/
|