From 3bb2704dcc25bc83a02fcdc87cf73c562ccb4ca9 Mon Sep 17 00:00:00 2001 From: "sfraser%netscape.com" Date: Fri, 4 Apr 2003 01:45:06 +0000 Subject: [PATCH] Remove nsIIndpendentSelection, moving its one method onto nsISelectionPrivate. Bug 192827. r/sr=kin. git-svn-id: svn://10.0.0.236/trunk@140665 18797224-902f-48f8-a5cc-f745e15eee43 --- .../base/public/nsISelectionPrivate.idl | 4 + mozilla/content/base/src/nsSelection.cpp | 52 +------------ .../libeditor/html/nsHTMLDataTransfer.cpp | 2 - .../editor/libeditor/html/nsHTMLEditor.cpp | 2 - .../text/nsPlaintextDataTransfer.cpp | 1 - .../libeditor/text/nsPlaintextEditor.cpp | 8 +- mozilla/layout/base/public/MANIFEST | 1 - mozilla/layout/base/public/Makefile.in | 1 - .../base/public/nsIIndependentSelection.h | 74 ------------------- mozilla/layout/generic/nsSelection.cpp | 52 +------------ 10 files changed, 15 insertions(+), 182 deletions(-) delete mode 100644 mozilla/layout/base/public/nsIIndependentSelection.h diff --git a/mozilla/content/base/public/nsISelectionPrivate.idl b/mozilla/content/base/public/nsISelectionPrivate.idl index f429cf7c0e9..8c0754ec455 100644 --- a/mozilla/content/base/public/nsISelectionPrivate.idl +++ b/mozilla/content/base/public/nsISelectionPrivate.idl @@ -43,6 +43,7 @@ interface nsIDOMRange; interface nsISelectionListener; +[ptr] native nsIPresShell(nsIPresShell); [scriptable, uuid(2d5535e2-1dd2-11b2-8e38-d53ec833adf6)] interface nsISelectionPrivate : nsISupports @@ -84,5 +85,8 @@ interface nsISelectionPrivate : nsISupports * a table element isn't selected. */ long getTableSelectionType(in nsIDOMRange range); + + /* Internal utility method to set the pres shell on a newly created selection */ + [noscript] void setPresShell(in nsIPresShell aPresShell); }; diff --git a/mozilla/content/base/src/nsSelection.cpp b/mozilla/content/base/src/nsSelection.cpp index 2035916f184..bcc44c63ca9 100644 --- a/mozilla/content/base/src/nsSelection.cpp +++ b/mozilla/content/base/src/nsSelection.cpp @@ -69,7 +69,6 @@ #include "nsISelectionListener.h" #include "nsIContentIterator.h" #include "nsIDocumentEncoder.h" -#include "nsIIndependentSelection.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" @@ -173,8 +172,7 @@ static void printRange(nsIDOMRange *aDomRange); class nsTypedSelection : public nsISelection, public nsISelectionPrivate, - public nsSupportsWeakReference, - public nsIIndependentSelection + public nsSupportsWeakReference { public: nsTypedSelection(); @@ -182,44 +180,8 @@ public: virtual ~nsTypedSelection(); NS_DECL_ISUPPORTS - /*BEGIN nsIIndependentSelection interface implementations */ - NS_IMETHOD SetPresShell(nsIPresShell *aPresShell); - - /*BEGIN nsISelection,Private interface implementations*/ - NS_IMETHOD GetAnchorNode(nsIDOMNode** aAnchorNode); - NS_IMETHOD GetAnchorOffset(PRInt32* aAnchorOffset); - NS_IMETHOD GetFocusNode(nsIDOMNode** aFocusNode); - NS_IMETHOD GetFocusOffset(PRInt32* aFocusOffset); - NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed); - NS_IMETHOD GetRangeCount(PRInt32* aRangeCount); - NS_IMETHOD GetRangeAt(PRInt32 aIndex, nsIDOMRange** aReturn); - NS_IMETHOD RemoveAllRanges(); - NS_IMETHOD GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSelectionType); - NS_IMETHOD Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset); - NS_IMETHOD CollapseToStart(); - NS_IMETHOD CollapseToEnd(); - NS_IMETHOD SelectAllChildren(nsIDOMNode* parentNode); - NS_IMETHOD Extend(nsIDOMNode* aParentNode, PRInt32 aOffset); - NS_IMETHOD ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aAYes); - NS_IMETHOD DeleteFromDocument(); - NS_IMETHOD AddRange(nsIDOMRange* aRange); - NS_IMETHOD RemoveRange(nsIDOMRange* aRange); - - NS_IMETHOD StartBatchChanges(); - NS_IMETHOD EndBatchChanges(); - - NS_IMETHOD AddSelectionListener(nsISelectionListener* aNewListener); - NS_IMETHOD RemoveSelectionListener(nsISelectionListener* aListenerToRemove); - NS_IMETHOD GetEnumerator(nsIEnumerator **aIterator); - - NS_IMETHOD ToString(PRUnichar **_retval); - NS_IMETHOD ToStringWithFormat(const char *aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, PRUnichar ** aReturn); - - NS_IMETHOD GetInterlinePosition(PRBool *aInterlinePosition); - NS_IMETHOD SetInterlinePosition(PRBool aInterlinePosition); - NS_IMETHOD SelectionLanguageChange(PRBool aLangRTL); - -/*END nsISelection interface implementations*/ + NS_DECL_NSISELECTION + NS_DECL_NSISELECTIONPRIVATE // utility methods for scrolling the selection into view nsresult GetPresContext(nsIPresContext **aPresContext); @@ -4630,15 +4592,10 @@ nsSelection::GetMouseDoubleDown(PRBool *aDoubleDown) //END nsISelection interface implementations -#ifdef XP_MAC +#if 0 #pragma mark - #endif - - - - - // nsTypedSelection implementation // note: this can return a nil anchor node @@ -4685,7 +4642,6 @@ NS_INTERFACE_MAP_BEGIN(nsTypedSelection) NS_INTERFACE_MAP_ENTRY(nsISelection) NS_INTERFACE_MAP_ENTRY(nsISelectionPrivate) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) - NS_INTERFACE_MAP_ENTRY(nsIIndependentSelection) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISelection) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Selection) NS_INTERFACE_MAP_END diff --git a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp index 5ae55b4a0a6..7eb4cf9a121 100644 --- a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -64,8 +64,6 @@ #include "nsISelectionController.h" #include "nsIFileChannel.h" #include "nsIFrameSelection.h" // For TABLESELECTION_ defines -#include "nsIIndependentSelection.h" //domselections answer to frameselection - #include "nsICSSLoader.h" #include "nsICSSStyleSheet.h" diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 794fb4a67d6..374d74464c4 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -78,8 +78,6 @@ #include "TransactionFactory.h" -#include "nsIIndependentSelection.h" //domselections answer to frameselection - #include "nsICSSLoader.h" #include "nsICSSStyleSheet.h" #include "nsIHTMLContentContainer.h" diff --git a/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp b/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp index 44bba6aa34b..65b2056b68a 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp @@ -59,7 +59,6 @@ #include "nsISelectionController.h" #include "nsIFrameSelection.h" // For TABLESELECTION_ defines -#include "nsIIndependentSelection.h" //domselections answer to frameselection #include "nsICSSLoader.h" #include "nsICSSStyleSheet.h" diff --git a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp index d6393858dfd..b2e1e3cd25e 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp @@ -64,8 +64,6 @@ #include "nsIDOMEventGroup.h" #include "nsCRT.h" -#include "nsIIndependentSelection.h" //domselections answer to frameselection - #include "nsIDocumentObserver.h" #include "nsIDocumentStateListener.h" @@ -1484,9 +1482,9 @@ nsPlaintextEditor::GetAndInitDocEncoder(const nsAString& aFormatType, if (!selection) return NS_ERROR_FAILURE; // get the independent selection interface - nsCOMPtr indSel = do_QueryInterface(selection); - if (indSel) - indSel->SetPresShell(presShell); + nsCOMPtr selPriv(do_QueryInterface(selection)); + if (selPriv) + selPriv->SetPresShell(presShell); nsCOMPtr content(do_QueryInterface(rootElement)); if (content) diff --git a/mozilla/layout/base/public/MANIFEST b/mozilla/layout/base/public/MANIFEST index 569e7861c38..c9e7b9da0d2 100644 --- a/mozilla/layout/base/public/MANIFEST +++ b/mozilla/layout/base/public/MANIFEST @@ -20,7 +20,6 @@ nsIFrameTraversal.h nsIFrameUtil.h nsIImageFrame.h nsIImageMap.h -nsIIndependentSelection.h nsILayoutDebugger.h nsILayoutHistoryState.h nsIMutableStyleContext.h diff --git a/mozilla/layout/base/public/Makefile.in b/mozilla/layout/base/public/Makefile.in index 7f1a49cedca..55397cd4f98 100644 --- a/mozilla/layout/base/public/Makefile.in +++ b/mozilla/layout/base/public/Makefile.in @@ -50,7 +50,6 @@ nsIFrameTraversal.h \ nsIFrameUtil.h \ nsIImageFrame.h \ nsIImageMap.h \ -nsIIndependentSelection.h \ nsILayoutDebugger.h \ nsILayoutHistoryState.h \ nsIMutableStyleContext.h \ diff --git a/mozilla/layout/base/public/nsIIndependentSelection.h b/mozilla/layout/base/public/nsIIndependentSelection.h deleted file mode 100644 index 49ee2863aa7..00000000000 --- a/mozilla/layout/base/public/nsIIndependentSelection.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape 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/NPL/ - * - * 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 mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * NOTE!! This is not a general class, but specific to layout and frames. - * Consumers looking for the general selection interface should look at - * nsISelection. - */ - - -#ifndef nsIIndependentSelection_h___ -#define nsIIndependentSelection_h___ - -#include "nsISupports.h" - - - - -#define NS_IINDEPENDENTSELECTION_IID \ -/* {3B7ABF61-33DB-4a47-8FFA-FFD6EA47CB1A} */ \ -{ 0x3b7abf61, 0x33db, 0x4a47, \ - { 0x8f, 0xfa, 0xff, 0xd6, 0xea, 0x47, 0xcb, 0x1a } } - - - -/*This interface is used to allow nsDOMSelection become more of an independent entity from nsSelection. */ -class nsIIndependentSelection: public nsISupports -{ -public: - NS_DEFINE_STATIC_IID_ACCESSOR(NS_IINDEPENDENTSELECTION_IID) - - /** SetPresShell - * this method sets the internal pres shell to aPresShell - * @param aPresShell weak reference should be kept to this. - */ - NS_IMETHOD SetPresShell(nsIPresShell *aPresShell) =0; -}; - -#endif //nsIIndependentSelection_h___ diff --git a/mozilla/layout/generic/nsSelection.cpp b/mozilla/layout/generic/nsSelection.cpp index 2035916f184..bcc44c63ca9 100644 --- a/mozilla/layout/generic/nsSelection.cpp +++ b/mozilla/layout/generic/nsSelection.cpp @@ -69,7 +69,6 @@ #include "nsISelectionListener.h" #include "nsIContentIterator.h" #include "nsIDocumentEncoder.h" -#include "nsIIndependentSelection.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" @@ -173,8 +172,7 @@ static void printRange(nsIDOMRange *aDomRange); class nsTypedSelection : public nsISelection, public nsISelectionPrivate, - public nsSupportsWeakReference, - public nsIIndependentSelection + public nsSupportsWeakReference { public: nsTypedSelection(); @@ -182,44 +180,8 @@ public: virtual ~nsTypedSelection(); NS_DECL_ISUPPORTS - /*BEGIN nsIIndependentSelection interface implementations */ - NS_IMETHOD SetPresShell(nsIPresShell *aPresShell); - - /*BEGIN nsISelection,Private interface implementations*/ - NS_IMETHOD GetAnchorNode(nsIDOMNode** aAnchorNode); - NS_IMETHOD GetAnchorOffset(PRInt32* aAnchorOffset); - NS_IMETHOD GetFocusNode(nsIDOMNode** aFocusNode); - NS_IMETHOD GetFocusOffset(PRInt32* aFocusOffset); - NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed); - NS_IMETHOD GetRangeCount(PRInt32* aRangeCount); - NS_IMETHOD GetRangeAt(PRInt32 aIndex, nsIDOMRange** aReturn); - NS_IMETHOD RemoveAllRanges(); - NS_IMETHOD GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSelectionType); - NS_IMETHOD Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset); - NS_IMETHOD CollapseToStart(); - NS_IMETHOD CollapseToEnd(); - NS_IMETHOD SelectAllChildren(nsIDOMNode* parentNode); - NS_IMETHOD Extend(nsIDOMNode* aParentNode, PRInt32 aOffset); - NS_IMETHOD ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aAYes); - NS_IMETHOD DeleteFromDocument(); - NS_IMETHOD AddRange(nsIDOMRange* aRange); - NS_IMETHOD RemoveRange(nsIDOMRange* aRange); - - NS_IMETHOD StartBatchChanges(); - NS_IMETHOD EndBatchChanges(); - - NS_IMETHOD AddSelectionListener(nsISelectionListener* aNewListener); - NS_IMETHOD RemoveSelectionListener(nsISelectionListener* aListenerToRemove); - NS_IMETHOD GetEnumerator(nsIEnumerator **aIterator); - - NS_IMETHOD ToString(PRUnichar **_retval); - NS_IMETHOD ToStringWithFormat(const char *aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, PRUnichar ** aReturn); - - NS_IMETHOD GetInterlinePosition(PRBool *aInterlinePosition); - NS_IMETHOD SetInterlinePosition(PRBool aInterlinePosition); - NS_IMETHOD SelectionLanguageChange(PRBool aLangRTL); - -/*END nsISelection interface implementations*/ + NS_DECL_NSISELECTION + NS_DECL_NSISELECTIONPRIVATE // utility methods for scrolling the selection into view nsresult GetPresContext(nsIPresContext **aPresContext); @@ -4630,15 +4592,10 @@ nsSelection::GetMouseDoubleDown(PRBool *aDoubleDown) //END nsISelection interface implementations -#ifdef XP_MAC +#if 0 #pragma mark - #endif - - - - - // nsTypedSelection implementation // note: this can return a nil anchor node @@ -4685,7 +4642,6 @@ NS_INTERFACE_MAP_BEGIN(nsTypedSelection) NS_INTERFACE_MAP_ENTRY(nsISelection) NS_INTERFACE_MAP_ENTRY(nsISelectionPrivate) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) - NS_INTERFACE_MAP_ENTRY(nsIIndependentSelection) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISelection) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Selection) NS_INTERFACE_MAP_END