Implement IHtmlDocument2::get_selection and range objects in ActiveX control. Checkin on behalf of Alexandre Tr�mon <atremon@elansoftware.com>. r=adamlock a=jst a=chofmann

This commit is contained in:
locka%iol.ie 2004-03-15 19:20:12 +00:00
parent 1496020612
commit 08fb7bc6f1
4 changed files with 52 additions and 5 deletions

View File

@ -61,7 +61,7 @@ protected:
class CIEHtmlTxtRange :
public CRange,
public IDispatchImpl<IHTMLTxtRange, &IID_IHTMLTxtRange, &LIBID_MOZILLAHTMLLib>
public IDispatchImpl<IHTMLTxtRange, &IID_IHTMLTxtRange, &LIBID_MSHTML>
{
public:
CIEHtmlTxtRange();
@ -119,7 +119,7 @@ typedef CComObject<CIEHtmlTxtRange> CIEHtmlTxtRangeInstance;
class CIEHtmlControlRange :
public CRange,
public IDispatchImpl<IHTMLControlRange, &IID_IHTMLControlRange, &LIBID_MOZILLAHTMLLib>
public IDispatchImpl<IHTMLControlRange, &IID_IHTMLControlRange, &LIBID_MSHTML>
{
public:
CIEHtmlControlRange();

View File

@ -50,6 +50,8 @@ CPPSRCS = \
ControlEventSink.cpp \
PropertyBag.cpp \
ItemContainer.cpp \
IEHtmlSelectionObject.cpp \
IEHtmlTxtRange.cpp \
$(NULL)
EXPORTS = \
@ -65,8 +67,9 @@ EXPORTS = \
IOleCommandTargetImpl.h \
IWebBrowserImpl.h \
IHTMLLocationImpl.h \
CPMozillaControl.h
CPMozillaControl.h \
IEHtmlSelectionObject.h \
IEHtmlTxtRange.h
# we don't want the shared lib, but we want to force the creation of a
# static lib.

View File

@ -47,6 +47,8 @@
#include "MozillaBrowser.h"
#include "IEHtmlSelectionObject.h"
CIEHtmlDocument::CIEHtmlDocument() :
mControl(NULL)
{
@ -323,8 +325,34 @@ HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_designMode(BSTR __RPC_FAR *p)
HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_selection(IHTMLSelectionObject __RPC_FAR *__RPC_FAR *p)
{
if (p == NULL)
{
return E_INVALIDARG;
}
*p = NULL;
return E_NOTIMPL;
// create com object:
CIEHtmlSelectionObjectInstance *pSelectionObject = NULL;
CIEHtmlSelectionObjectInstance::CreateInstance(&pSelectionObject);
if (!pSelectionObject)
return E_FAIL;
// get selection:
nsCOMPtr<nsIDOMWindow> domWindow;
mControl->GetDOMWindow(getter_AddRefs(domWindow));
if (!domWindow)
return E_FAIL;
nsCOMPtr<nsISelection> selection;
domWindow->GetSelection(getter_AddRefs(selection));
if (!selection)
return E_FAIL;
// gives the selection to the com object:
pSelectionObject->SetSelection(selection);
nsCOMPtr<nsIDOMDocumentRange> domDocumentRange = do_QueryInterface(mDOMDocument);
pSelectionObject->SetDOMDocumentRange(domDocumentRange);
// return com object:
pSelectionObject->QueryInterface(IID_IHTMLSelectionObject, (void **)p);
return S_OK;
}

View File

@ -238,6 +238,14 @@ SOURCE=..\common\IEHtmlNode.cpp
# End Source File
# Begin Source File
SOURCE=..\common\IEHtmlSelectionObject.cpp
# End Source File
# Begin Source File
SOURCE=..\common\IEHtmlTxtRange.cpp
# End Source File
# Begin Source File
SOURCE=..\common\ItemContainer.cpp
# End Source File
# Begin Source File
@ -278,6 +286,14 @@ SOURCE=..\common\IEHtmlNode.h
# End Source File
# Begin Source File
SOURCE=..\common\IEHtmlSelectionObject.h
# End Source File
# Begin Source File
SOURCE=..\common\IEHtmlTxtRange.h
# End Source File
# Begin Source File
SOURCE=..\common\IHTMLLocationImpl.h
# End Source File
# Begin Source File