1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISelection.idl"
10 interface nsISelectionListener
;
18 template
<class T
> class nsTArray
;
19 #include
"nsDirection.h"
20 #include
"nsIPresShell.h" // TODO: Remove this include
21 #include
"mozilla/EventForwards.h"
24 [ptr] native nsIFrame
(nsIFrame
);
25 [ptr] native RangeArray
(nsTArray
<nsRange
*>);
26 [ref] native constTextRangeStyleRef
(const mozilla
::TextRangeStyle
);
27 [ref] native nsPointRef
(nsPoint
);
28 native nsDirection
(nsDirection
);
29 native ScrollAxis
(nsIPresShell
::ScrollAxis
);
31 [scriptable
, builtinclass
, uuid(5a82ee9a
-35ce
-11e4
-8c3e
-b7043d68ad70
)]
32 interface nsISelectionPrivate
: nsISelection
34 const short ENDOFPRECEDINGLINE
=0;
35 const short STARTOFNEXTLINE
=1;
37 attribute
boolean interlinePosition
;
38 [noscript
] attribute nsIContent ancestorLimiter
;
41 match this up with endbatchChanges. will stop ui updates while multiple selection methods are called
43 [noscript
] void startBatchChanges
();
46 match this up with startBatchChanges
48 [noscript
] void endBatchChanges
();
50 DOMString toStringWithFormat
(in string formatType
, in unsigned long flags
, in int32_t wrapColumn
);
51 void addSelectionListener
(in nsISelectionListener newListener
);
52 void removeSelectionListener
(in nsISelectionListener listenerToRemove
);
54 /* Table selection stuff
55 We should probably move this and table-related
56 items in nsFrameSelection to a
57 new nsITableSelection interface
59 const long TABLESELECTION_NONE
= 0;
60 const long TABLESELECTION_CELL
= 1;
61 const long TABLESELECTION_ROW
= 2;
62 const long TABLESELECTION_COLUMN
= 3;
63 const long TABLESELECTION_TABLE
= 4;
64 const long TABLESELECTION_ALLCELLS
= 5;
66 /** Test if supplied range points to a single table element:
67 * Result is one of above constants. "None" means
68 * a table element isn't selected.
70 [noscript
] long getTableSelectionType
(in nsIDOMRange
range);
72 /* canCacheFrameOffset
73 * Frame Offset cache can be used just during calling nsEditor::EndPlaceHolderTransaction.
74 * EndPlaceHolderTransaction will give rise to reflow/refreshing view/scroll, and call times
75 * of nsTextFrame::GetPointFromOffset whose return value is to be cached.
76 * see bugs 35296 and 199412
78 [noscript
] attribute
boolean canCacheFrameOffset
;
80 /* GetCachedOffsetForFrame
81 * Returns cached value for nsTextFrame::GetPointFromOffset.
83 [noscript
] void getCachedFrameOffset
(in nsIFrame aFrame
, in int32_t inOffset
, in nsPointRef aPoint
);
86 * Set the painting style for the range. The range must be a range in
87 * the selection. The textRangeStyle will be used by text frame
88 * when it is painting the selection.
90 [noscript
] void setTextRangeStyle
(in nsIDOMRange
range,
91 in constTextRangeStyleRef textRangeStyle
);
94 * Get the direction of the selection.
96 [noscript
, notxpcom
] nsDirection getSelectionDirection
();
97 [noscript
, notxpcom
] void setSelectionDirection
(in nsDirection aDirection
);
100 * Returns the type of the selection (see nsISelectionController for
101 * available constants).
103 readonly attribute
short type
;
106 * Return array of ranges intersecting with the given DOM interval.
108 void GetRangesForInterval
(
109 in nsIDOMNode beginNode
, in int32_t beginOffset
,
110 in nsIDOMNode endNode
, in int32_t endOffset
,
111 in boolean allowAdjacent
,
112 out uint32_t resultCount
,
113 [retval, array
, size_is(resultCount
)] out nsIDOMRange results
);
115 [noscript
] void GetRangesForIntervalArray
(
116 in nsINode beginNode
, in int32_t beginOffset
,
117 in nsINode endNode
, in int32_t endOffset
,
118 in boolean allowAdjacent
,
119 in RangeArray results
);
122 * Scrolls a region of the selection, so that it is visible in
125 * @param aRegion - the region inside the selection to scroll into view
126 * (see selection region constants defined in
127 * nsISelectionController).
128 * @param aIsSynchronous - when true, scrolls the selection into view
129 * before returning. If false, posts a request which
130 * is processed at some point after the method returns.
131 * @param aVPercent - how to align the frame vertically.
132 * @param aHPercent - how to align the frame horizontally.
134 void scrollIntoView
(in short aRegion
, in boolean aIsSynchronous
,
135 in int16_t aVPercent
,
136 in int16_t aHPercent
);
139 * Scrolls a region of the selection, so that it is visible in
142 * @param aRegion - the region inside the selection to scroll into view
143 * (see selection region constants defined in
144 * nsISelectionController).
145 * @param aIsSynchronous - when true, scrolls the selection into view
146 * before returning. If false, posts a request which
147 * is processed at some point after the method returns.
148 * @param aVertical - how to align the frame vertically and when.
149 * See nsIPresShell.h:ScrollAxis for details.
150 * @param aHorizontal - how to align the frame horizontally and when.
151 * See nsIPresShell.h:ScrollAxis for details.
153 [noscript
] void scrollIntoViewInternal
(in short aRegion
,
154 in boolean aIsSynchronous
,
155 in ScrollAxis aVertical
,
156 in ScrollAxis aHorizontal
);
159 * Modifies the cursor Bidi level after a change in keyboard direction
160 * @param langRTL is PR_TRUE if the new language is right-to-left or
161 * PR_FALSE if the new language is left-to-right.
163 [noscript
] void selectionLanguageChange
(in boolean langRTL
);