changes to selection

This commit is contained in:
mjudge%netscape.com 1998-12-08 18:25:47 +00:00
parent 24b5ddbeb3
commit 35b965b62b
6 changed files with 20 additions and 54 deletions

View File

@ -30,11 +30,7 @@ class nsIDocumentContainer;
class nsIDocumentObserver;
class nsIPresContext;
class nsIPresShell;
#if XP_NEW_SELECTION
class nsICollection;
#else
class nsISelection;
#endif
class nsIStreamListener;
class nsIStreamObserver;
@ -207,11 +203,7 @@ public:
/**
* Returns the Selection Object
*/
#if XP_NEW_SELECTION
NS_IMETHOD GetSelection(nsICollection ** aSelection) = 0;
#else
NS_IMETHOD GetSelection(nsISelection *& aSelection) = 0;
#endif
/**
* Selects all the Content
*/

View File

@ -63,6 +63,8 @@ public:
virtual nsIStyleSet* GetStyleSet() = 0;
virtual nsresult SetFocus(nsIFrame *aFrame) = 0;
NS_IMETHOD EnterReflowLock() = 0;
NS_IMETHOD ExitReflowLock() = 0;

View File

@ -30,11 +30,7 @@ class nsIDocumentContainer;
class nsIDocumentObserver;
class nsIPresContext;
class nsIPresShell;
#if XP_NEW_SELECTION
class nsICollection;
#else
class nsISelection;
#endif
class nsIStreamListener;
class nsIStreamObserver;
@ -207,11 +203,7 @@ public:
/**
* Returns the Selection Object
*/
#if XP_NEW_SELECTION
NS_IMETHOD GetSelection(nsICollection ** aSelection) = 0;
#else
NS_IMETHOD GetSelection(nsISelection *& aSelection) = 0;
#endif
/**
* Selects all the Content
*/

View File

@ -63,6 +63,8 @@ public:
virtual nsIStyleSet* GetStyleSet() = 0;
virtual nsresult SetFocus(nsIFrame *aFrame) = 0;
NS_IMETHOD EnterReflowLock() = 0;
NS_IMETHOD ExitReflowLock() = 0;

View File

@ -18,9 +18,9 @@
#ifndef nsISelection_h___
#define nsISelection_h___
#include "nsSelectionRange.h"
#include "nslayout.h"
#include "nsISupports.h"
#include "nsIFrame.h"
// IID for the nsISelection interface
#define NS_ISELECTION_IID \
@ -33,37 +33,14 @@
class nsISelection : public nsISupports {
public:
/**
* Returns whether there is a valid selection
*/
virtual PRBool IsValidSelection() = 0;
/**
* Clears the current selection (invalidates the selection)
*/
virtual void ClearSelection() = 0;
/**
* Copies the data from the param into the internal Range
*/
virtual void SetRange(nsSelectionRange * aRange) = 0;
/**
* Copies the param's (aRange) contents with the Range's data
*/
virtual void GetRange(nsSelectionRange * aRange) = 0;
/**
* Copies the param's (aRange) contents with the Range's data
*/
virtual nsSelectionRange * GetRange() = 0;
virtual char * ToString() = 0;
/** HandleKeyEvent will accept an event and frame and
* will return NS_OK if it handles the event or NS_COMFALSE if not.
* <P>DOES NOT ADDREF<P>
* @param aGuiEvent is the event that should be dealt with by aFocusFrame
* @param aFrame is the frame that MAY handle the event
*/
virtual nsresult HandleKeyEvent(nsGUIEvent *aGuiEvent, nsIFrame *aFrame) = 0;
};
// XXX Belongs somewhere else
extern NS_LAYOUT nsresult
NS_NewSelection(nsISelection** aInstancePtrResult);
#endif /* nsISelection_h___ */

View File

@ -227,10 +227,16 @@ nsresult nsLayoutFactory::CreateInstance(nsISupports *aOuter,
refCounted = PR_TRUE;
}
else if (mClassID.Equals(kCRangeListCID)) {
res = NS_NewRangeList((nsICollection **)&inst);
nsICollection *coll;
res = NS_NewRangeList((nsICollection **)&coll);
if (!NS_SUCCEEDED(res)) {
return res;
}
res = coll->QueryInterface(kISupportsIID, (void **)&inst);
if (!NS_SUCCEEDED(res)) {
return res;
}
NS_IF_RELEASE(coll);
refCounted = PR_TRUE;
}
else if (mClassID.Equals(kCRangeCID)) {
@ -260,11 +266,6 @@ nsresult nsLayoutFactory::CreateInstance(nsISupports *aOuter,
return res;
refCounted = PR_TRUE;
}
else if (mClassID.Equals(kSelectionCID)) {
if (NS_FAILED(res = NS_NewSelection((nsISelection**) &inst)))
return res;
refCounted = PR_TRUE;
}
else
{
return NS_NOINTERFACE;