2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-09-14 05:24:18 +00:00
|
|
|
|
2011-08-07 20:17:00 +00:00
|
|
|
#include "nsISelection.idl"
|
2000-09-14 05:24:18 +00:00
|
|
|
|
2012-01-10 14:19:54 +00:00
|
|
|
interface nsRange;
|
2011-08-07 20:17:00 +00:00
|
|
|
interface nsIDOMNode;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
interface nsISelectionListener;
|
2007-06-28 02:48:16 +00:00
|
|
|
interface nsIContent;
|
2012-01-10 14:19:54 +00:00
|
|
|
interface nsINode;
|
2018-03-27 04:35:22 +00:00
|
|
|
interface nsIDOMRange;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2003-04-04 02:36:12 +00:00
|
|
|
%{C++
|
2013-08-06 20:19:11 +00:00
|
|
|
class nsIFrame;
|
2003-04-20 01:03:40 +00:00
|
|
|
struct nsPoint;
|
2012-03-20 02:09:50 +00:00
|
|
|
struct ScrollAxis;
|
2013-08-06 20:19:11 +00:00
|
|
|
#include "nsDirection.h"
|
|
|
|
#include "nsIPresShell.h" // TODO: Remove this include
|
2016-07-20 15:29:36 +00:00
|
|
|
#include "nsTArrayForwardDeclare.h"
|
2013-09-24 10:04:15 +00:00
|
|
|
#include "mozilla/EventForwards.h"
|
2003-04-04 02:36:12 +00:00
|
|
|
%}
|
|
|
|
|
2003-04-20 01:03:40 +00:00
|
|
|
[ptr] native nsIFrame(nsIFrame);
|
2012-01-10 14:19:54 +00:00
|
|
|
[ptr] native RangeArray(nsTArray<nsRange*>);
|
2003-04-20 01:03:40 +00:00
|
|
|
[ref] native nsPointRef(nsPoint);
|
2011-07-28 17:51:22 +00:00
|
|
|
native nsDirection(nsDirection);
|
2012-03-20 02:09:50 +00:00
|
|
|
native ScrollAxis(nsIPresShell::ScrollAxis);
|
2000-09-14 05:24:18 +00:00
|
|
|
|
2015-12-01 20:25:06 +00:00
|
|
|
[scriptable, builtinclass, uuid(0c9f4f74-ee7e-4fe9-be6b-0ba856368178)]
|
2017-09-11 22:19:22 +00:00
|
|
|
interface nsISelectionPrivate : nsISupports
|
2000-09-14 05:24:18 +00:00
|
|
|
{
|
|
|
|
const short ENDOFPRECEDINGLINE=0;
|
|
|
|
const short STARTOFNEXTLINE=1;
|
2013-12-17 14:12:33 +00:00
|
|
|
|
2000-09-14 05:24:18 +00:00
|
|
|
attribute boolean interlinePosition;
|
2014-09-09 23:27:56 +00:00
|
|
|
[noscript] attribute nsIContent ancestorLimiter;
|
2000-09-14 05:24:18 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
DOMString toStringWithFormat(in string formatType, in unsigned long flags, in int32_t wrapColumn);
|
2003-04-20 01:03:40 +00:00
|
|
|
void addSelectionListener(in nsISelectionListener newListener);
|
|
|
|
void removeSelectionListener(in nsISelectionListener listenerToRemove);
|
2000-12-20 22:13:54 +00:00
|
|
|
|
|
|
|
/* Table selection stuff
|
2016-07-20 15:29:36 +00:00
|
|
|
We should probably move this and table-related
|
2006-04-26 01:57:22 +00:00
|
|
|
items in nsFrameSelection to a
|
2000-12-20 22:13:54 +00:00
|
|
|
new nsITableSelection interface
|
|
|
|
*/
|
2013-12-17 14:12:33 +00:00
|
|
|
const long TABLESELECTION_NONE = 0;
|
|
|
|
const long TABLESELECTION_CELL = 1;
|
|
|
|
const long TABLESELECTION_ROW = 2;
|
|
|
|
const long TABLESELECTION_COLUMN = 3;
|
|
|
|
const long TABLESELECTION_TABLE = 4;
|
2000-12-20 22:13:54 +00:00
|
|
|
const long TABLESELECTION_ALLCELLS = 5;
|
|
|
|
|
|
|
|
/** Test if supplied range points to a single table element:
|
|
|
|
* Result is one of above constants. "None" means
|
|
|
|
* a table element isn't selected.
|
|
|
|
*/
|
2013-12-17 14:12:33 +00:00
|
|
|
[noscript] long getTableSelectionType(in nsIDOMRange range);
|
|
|
|
|
2003-04-20 01:03:40 +00:00
|
|
|
/* canCacheFrameOffset
|
|
|
|
* Frame Offset cache can be used just during calling nsEditor::EndPlaceHolderTransaction.
|
|
|
|
* EndPlaceHolderTransaction will give rise to reflow/refreshing view/scroll, and call times
|
|
|
|
* of nsTextFrame::GetPointFromOffset whose return value is to be cached.
|
|
|
|
* see bugs 35296 and 199412
|
|
|
|
*/
|
|
|
|
[noscript] attribute boolean canCacheFrameOffset;
|
|
|
|
|
|
|
|
/* GetCachedOffsetForFrame
|
|
|
|
* Returns cached value for nsTextFrame::GetPointFromOffset.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
[noscript] void getCachedFrameOffset(in nsIFrame aFrame, in int32_t inOffset, in nsPointRef aPoint);
|
2005-08-24 17:44:28 +00:00
|
|
|
|
2011-07-28 17:51:22 +00:00
|
|
|
/**
|
|
|
|
* Get the direction of the selection.
|
|
|
|
*/
|
|
|
|
[noscript, notxpcom] nsDirection getSelectionDirection();
|
|
|
|
[noscript, notxpcom] void setSelectionDirection(in nsDirection aDirection);
|
2016-07-20 15:29:36 +00:00
|
|
|
|
2011-08-07 20:17:00 +00:00
|
|
|
/**
|
|
|
|
* Returns the type of the selection (see nsISelectionController for
|
|
|
|
* available constants).
|
|
|
|
*/
|
|
|
|
readonly attribute short type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return array of ranges intersecting with the given DOM interval.
|
|
|
|
*/
|
|
|
|
void GetRangesForInterval(
|
2012-08-22 15:56:38 +00:00
|
|
|
in nsIDOMNode beginNode, in int32_t beginOffset,
|
|
|
|
in nsIDOMNode endNode, in int32_t endOffset,
|
2011-08-27 15:45:25 +00:00
|
|
|
in boolean allowAdjacent,
|
2012-08-22 15:56:38 +00:00
|
|
|
out uint32_t resultCount,
|
2011-08-07 20:17:00 +00:00
|
|
|
[retval, array, size_is(resultCount)] out nsIDOMRange results);
|
|
|
|
|
2012-01-10 14:19:54 +00:00
|
|
|
[noscript] void GetRangesForIntervalArray(
|
2012-08-22 15:56:38 +00:00
|
|
|
in nsINode beginNode, in int32_t beginOffset,
|
|
|
|
in nsINode endNode, in int32_t endOffset,
|
2011-08-27 15:45:25 +00:00
|
|
|
in boolean allowAdjacent,
|
2011-08-07 20:17:00 +00:00
|
|
|
in RangeArray results);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Scrolls a region of the selection, so that it is visible in
|
|
|
|
* the scrolled view.
|
|
|
|
*
|
|
|
|
* @param aRegion - the region inside the selection to scroll into view
|
|
|
|
* (see selection region constants defined in
|
|
|
|
* nsISelectionController).
|
|
|
|
* @param aIsSynchronous - when true, scrolls the selection into view
|
|
|
|
* before returning. If false, posts a request which
|
|
|
|
* is processed at some point after the method returns.
|
2012-03-20 02:09:50 +00:00
|
|
|
* @param aVPercent - how to align the frame vertically.
|
|
|
|
* @param aHPercent - how to align the frame horizontally.
|
2011-08-07 20:17:00 +00:00
|
|
|
*/
|
|
|
|
void scrollIntoView(in short aRegion, in boolean aIsSynchronous,
|
2012-08-22 15:56:38 +00:00
|
|
|
in int16_t aVPercent,
|
|
|
|
in int16_t aHPercent);
|
2012-03-20 02:09:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Scrolls a region of the selection, so that it is visible in
|
|
|
|
* the scrolled view.
|
|
|
|
*
|
|
|
|
* @param aRegion - the region inside the selection to scroll into view
|
|
|
|
* (see selection region constants defined in
|
|
|
|
* nsISelectionController).
|
|
|
|
* @param aIsSynchronous - when true, scrolls the selection into view
|
|
|
|
* before returning. If false, posts a request which
|
|
|
|
* is processed at some point after the method returns.
|
|
|
|
* @param aVertical - how to align the frame vertically and when.
|
|
|
|
* See nsIPresShell.h:ScrollAxis for details.
|
|
|
|
* @param aHorizontal - how to align the frame horizontally and when.
|
|
|
|
* See nsIPresShell.h:ScrollAxis for details.
|
|
|
|
*/
|
|
|
|
[noscript] void scrollIntoViewInternal(in short aRegion,
|
|
|
|
in boolean aIsSynchronous,
|
|
|
|
in ScrollAxis aVertical,
|
|
|
|
in ScrollAxis aHorizontal);
|
2013-12-17 14:12:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Modifies the cursor Bidi level after a change in keyboard direction
|
|
|
|
* @param langRTL is PR_TRUE if the new language is right-to-left or
|
|
|
|
* PR_FALSE if the new language is left-to-right.
|
|
|
|
*/
|
|
|
|
[noscript] void selectionLanguageChange(in boolean langRTL);
|
2017-05-10 14:48:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* setColors() sets custom colors for the selection.
|
|
|
|
* Currently, this is supported only when the selection type is SELECTION_FIND.
|
|
|
|
* Otherwise, throws an exception.
|
|
|
|
*
|
|
|
|
* @param aForegroundColor The foreground color of the selection.
|
|
|
|
* If this is "currentColor", foreground color
|
|
|
|
* isn't changed by this selection.
|
|
|
|
* @param aBackgroundColor The background color of the selection.
|
|
|
|
* If this is "transparent", background color is
|
|
|
|
* never painted.
|
|
|
|
* @param aAltForegroundColor The alternative foreground color of the
|
|
|
|
* selection.
|
|
|
|
* If aBackgroundColor doesn't have sufficient
|
|
|
|
* contrast with its around or foreground color
|
|
|
|
* if "currentColor" is specified, alternative
|
|
|
|
* colors are used if it have higher contrast.
|
|
|
|
* @param aAltBackgroundColor The alternative background color of the
|
|
|
|
* selection.
|
|
|
|
*/
|
|
|
|
void setColors(in DOMString aForegroundColor,
|
|
|
|
in DOMString aBackgroundColor,
|
|
|
|
in DOMString aAltForegroundColor,
|
|
|
|
in DOMString aAltBackgroundColor);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* resetColors() forget the customized colors which were set by setColors().
|
|
|
|
*/
|
|
|
|
void resetColors();
|
2000-09-14 05:24:18 +00:00
|
|
|
};
|
|
|
|
|