michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISelection.idl" michael@0: michael@0: interface nsRange; michael@0: interface nsIDOMNode; michael@0: interface nsISelectionListener; michael@0: interface nsIContent; michael@0: interface nsINode; michael@0: michael@0: %{C++ michael@0: class nsIFrame; michael@0: struct nsPoint; michael@0: struct ScrollAxis; michael@0: template class nsTArray; michael@0: #include "nsDirection.h" michael@0: #include "nsIPresShell.h" // TODO: Remove this include michael@0: #include "mozilla/EventForwards.h" michael@0: %} michael@0: michael@0: [ptr] native nsIFrame(nsIFrame); michael@0: [ptr] native RangeArray(nsTArray); michael@0: [ref] native constTextRangeStyleRef(const mozilla::TextRangeStyle); michael@0: [ref] native nsPointRef(nsPoint); michael@0: native nsDirection(nsDirection); michael@0: native ScrollAxis(nsIPresShell::ScrollAxis); michael@0: michael@0: [scriptable, builtinclass, uuid(52629837-7b3f-4434-940d-a14de7ef9b7a)] michael@0: interface nsISelectionPrivate : nsISelection michael@0: { michael@0: const short ENDOFPRECEDINGLINE=0; michael@0: const short STARTOFNEXTLINE=1; michael@0: michael@0: attribute boolean interlinePosition; michael@0: michael@0: /* startBatchChanges michael@0: match this up with endbatchChanges. will stop ui updates while multiple selection methods are called michael@0: */ michael@0: [noscript] void startBatchChanges(); michael@0: michael@0: /* endBatchChanges michael@0: match this up with startBatchChanges michael@0: */ michael@0: [noscript] void endBatchChanges(); michael@0: michael@0: DOMString toStringWithFormat(in string formatType, in unsigned long flags, in int32_t wrapColumn); michael@0: void addSelectionListener(in nsISelectionListener newListener); michael@0: void removeSelectionListener(in nsISelectionListener listenerToRemove); michael@0: michael@0: /* Table selection stuff michael@0: We should probably move this and table-related michael@0: items in nsFrameSelection to a michael@0: new nsITableSelection interface michael@0: */ michael@0: const long TABLESELECTION_NONE = 0; michael@0: const long TABLESELECTION_CELL = 1; michael@0: const long TABLESELECTION_ROW = 2; michael@0: const long TABLESELECTION_COLUMN = 3; michael@0: const long TABLESELECTION_TABLE = 4; michael@0: const long TABLESELECTION_ALLCELLS = 5; michael@0: michael@0: /** Test if supplied range points to a single table element: michael@0: * Result is one of above constants. "None" means michael@0: * a table element isn't selected. michael@0: */ michael@0: [noscript] long getTableSelectionType(in nsIDOMRange range); michael@0: michael@0: /* canCacheFrameOffset michael@0: * Frame Offset cache can be used just during calling nsEditor::EndPlaceHolderTransaction. michael@0: * EndPlaceHolderTransaction will give rise to reflow/refreshing view/scroll, and call times michael@0: * of nsTextFrame::GetPointFromOffset whose return value is to be cached. michael@0: * see bugs 35296 and 199412 michael@0: */ michael@0: [noscript] attribute boolean canCacheFrameOffset; michael@0: michael@0: /* GetCachedOffsetForFrame michael@0: * Returns cached value for nsTextFrame::GetPointFromOffset. michael@0: */ michael@0: [noscript] void getCachedFrameOffset(in nsIFrame aFrame, in int32_t inOffset, in nsPointRef aPoint); michael@0: michael@0: [noscript] void setAncestorLimiter(in nsIContent aContent); michael@0: michael@0: /** michael@0: * Set the painting style for the range. The range must be a range in michael@0: * the selection. The textRangeStyle will be used by text frame michael@0: * when it is painting the selection. michael@0: */ michael@0: [noscript] void setTextRangeStyle(in nsIDOMRange range, michael@0: in constTextRangeStyleRef textRangeStyle); michael@0: michael@0: /** michael@0: * Get the direction of the selection. michael@0: */ michael@0: [noscript, notxpcom] nsDirection getSelectionDirection(); michael@0: [noscript, notxpcom] void setSelectionDirection(in nsDirection aDirection); michael@0: michael@0: /** michael@0: * Returns the type of the selection (see nsISelectionController for michael@0: * available constants). michael@0: */ michael@0: readonly attribute short type; michael@0: michael@0: /** michael@0: * Return array of ranges intersecting with the given DOM interval. michael@0: */ michael@0: void GetRangesForInterval( michael@0: in nsIDOMNode beginNode, in int32_t beginOffset, michael@0: in nsIDOMNode endNode, in int32_t endOffset, michael@0: in boolean allowAdjacent, michael@0: out uint32_t resultCount, michael@0: [retval, array, size_is(resultCount)] out nsIDOMRange results); michael@0: michael@0: [noscript] void GetRangesForIntervalArray( michael@0: in nsINode beginNode, in int32_t beginOffset, michael@0: in nsINode endNode, in int32_t endOffset, michael@0: in boolean allowAdjacent, michael@0: in RangeArray results); michael@0: michael@0: /** michael@0: * Scrolls a region of the selection, so that it is visible in michael@0: * the scrolled view. michael@0: * michael@0: * @param aRegion - the region inside the selection to scroll into view michael@0: * (see selection region constants defined in michael@0: * nsISelectionController). michael@0: * @param aIsSynchronous - when true, scrolls the selection into view michael@0: * before returning. If false, posts a request which michael@0: * is processed at some point after the method returns. michael@0: * @param aVPercent - how to align the frame vertically. michael@0: * @param aHPercent - how to align the frame horizontally. michael@0: */ michael@0: void scrollIntoView(in short aRegion, in boolean aIsSynchronous, michael@0: in int16_t aVPercent, michael@0: in int16_t aHPercent); michael@0: michael@0: /** michael@0: * Scrolls a region of the selection, so that it is visible in michael@0: * the scrolled view. michael@0: * michael@0: * @param aRegion - the region inside the selection to scroll into view michael@0: * (see selection region constants defined in michael@0: * nsISelectionController). michael@0: * @param aIsSynchronous - when true, scrolls the selection into view michael@0: * before returning. If false, posts a request which michael@0: * is processed at some point after the method returns. michael@0: * @param aVertical - how to align the frame vertically and when. michael@0: * See nsIPresShell.h:ScrollAxis for details. michael@0: * @param aHorizontal - how to align the frame horizontally and when. michael@0: * See nsIPresShell.h:ScrollAxis for details. michael@0: */ michael@0: [noscript] void scrollIntoViewInternal(in short aRegion, michael@0: in boolean aIsSynchronous, michael@0: in ScrollAxis aVertical, michael@0: in ScrollAxis aHorizontal); michael@0: michael@0: /** michael@0: * Modifies the cursor Bidi level after a change in keyboard direction michael@0: * @param langRTL is PR_TRUE if the new language is right-to-left or michael@0: * PR_FALSE if the new language is left-to-right. michael@0: */ michael@0: [noscript] void selectionLanguageChange(in boolean langRTL); michael@0: }; michael@0: