Back to index

lightning-sunbird  0.9+nobinonly
IEHtmlTxtRange.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Alexandre Trémon <atremon@elansoftware.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 #ifndef IEHTMLTXTRANGE_H
00039 #define IEHTMLTXTRANGE_H
00040 
00041 #include "nsIDOMRange.h"
00042 
00043 class CRange :
00044     public CComObjectRootEx<CComMultiThreadModel>
00045 {
00046 public:
00047     CRange();
00048 
00049 protected:
00050     virtual ~CRange();
00051 
00052 public:
00053     void SetRange(nsIDOMRange *pRange);
00054 
00055     virtual HRESULT GetParentElement(IHTMLElement **ppParent);
00056 
00057 protected:
00058     nsCOMPtr<nsIDOMRange> mRange;
00059 };
00060 
00061 class CIEHtmlTxtRange :
00062     public CRange,
00063     public IDispatchImpl<IHTMLTxtRange, &IID_IHTMLTxtRange, &LIBID_MSHTML>
00064 {
00065 public:
00066     CIEHtmlTxtRange();
00067 
00068 protected:
00069     virtual ~CIEHtmlTxtRange();
00070 
00071 public:
00072 
00073 BEGIN_COM_MAP(CIEHtmlTxtRange)
00074     COM_INTERFACE_ENTRY(IDispatch)
00075     COM_INTERFACE_ENTRY(IHTMLTxtRange)
00076 END_COM_MAP()
00077 
00078 
00079     // Implementation of IHTMLTxtRange
00080     virtual HRESULT STDMETHODCALLTYPE pasteHTML(BSTR html);
00081     virtual HRESULT STDMETHODCALLTYPE get_text(BSTR __RPC_FAR *p);
00082     virtual HRESULT STDMETHODCALLTYPE parentElement(IHTMLElement __RPC_FAR *__RPC_FAR *Parent);
00083     // Not yet implemented
00084     virtual HRESULT STDMETHODCALLTYPE get_htmlText(BSTR __RPC_FAR *p);
00085     virtual HRESULT STDMETHODCALLTYPE put_text(BSTR v);
00086     virtual HRESULT STDMETHODCALLTYPE duplicate(IHTMLTxtRange __RPC_FAR *__RPC_FAR *Duplicate);
00087     virtual HRESULT STDMETHODCALLTYPE inRange(IHTMLTxtRange __RPC_FAR *Range, VARIANT_BOOL __RPC_FAR *InRange);
00088     virtual HRESULT STDMETHODCALLTYPE isEqual(IHTMLTxtRange __RPC_FAR *Range, VARIANT_BOOL __RPC_FAR *IsEqual);
00089     virtual HRESULT STDMETHODCALLTYPE scrollIntoView(VARIANT_BOOL fStart = -1);
00090     virtual HRESULT STDMETHODCALLTYPE collapse(VARIANT_BOOL Start = -1);
00091     virtual HRESULT STDMETHODCALLTYPE expand(BSTR Unit,VARIANT_BOOL __RPC_FAR *Success);
00092     virtual HRESULT STDMETHODCALLTYPE move(BSTR Unit, long Count, long __RPC_FAR *ActualCount);
00093     virtual HRESULT STDMETHODCALLTYPE moveStart(BSTR Unit, long Count, long __RPC_FAR *ActualCount);
00094     virtual HRESULT STDMETHODCALLTYPE moveEnd(BSTR Unit, long Count, long __RPC_FAR *ActualCount);
00095     virtual HRESULT STDMETHODCALLTYPE select( void);
00096     virtual HRESULT STDMETHODCALLTYPE moveToElementText(IHTMLElement __RPC_FAR *element);
00097     virtual HRESULT STDMETHODCALLTYPE setEndPoint(BSTR how, IHTMLTxtRange __RPC_FAR *SourceRange);
00098     virtual HRESULT STDMETHODCALLTYPE compareEndPoints(BSTR how, IHTMLTxtRange __RPC_FAR *SourceRange, long __RPC_FAR *ret);
00099     virtual HRESULT STDMETHODCALLTYPE findText(BSTR String, long count, long Flags, VARIANT_BOOL __RPC_FAR *Success);
00100     virtual HRESULT STDMETHODCALLTYPE moveToPoint(long x, long y);
00101     virtual HRESULT STDMETHODCALLTYPE getBookmark(BSTR __RPC_FAR *Boolmark);
00102     virtual HRESULT STDMETHODCALLTYPE moveToBookmark(BSTR Bookmark, VARIANT_BOOL __RPC_FAR *Success);
00103     virtual HRESULT STDMETHODCALLTYPE queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00104     virtual HRESULT STDMETHODCALLTYPE queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00105     virtual HRESULT STDMETHODCALLTYPE queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00106     virtual HRESULT STDMETHODCALLTYPE queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00107     virtual HRESULT STDMETHODCALLTYPE queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText);
00108     virtual HRESULT STDMETHODCALLTYPE queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue);
00109     virtual HRESULT STDMETHODCALLTYPE execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet);
00110     virtual HRESULT STDMETHODCALLTYPE execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00111 };
00112 
00113 #define CIEHTMLTXTRANGE_INTERFACES \
00114     COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLTxtRange \
00115     COM_INTERFACE_ENTRY_IID(IID_IHTMLTxtRange, IHTMLTxtRange)
00116 
00117 typedef CComObject<CIEHtmlTxtRange> CIEHtmlTxtRangeInstance;
00118 
00119 class CIEHtmlControlRange :
00120     public CRange,
00121     public IDispatchImpl<IHTMLControlRange, &IID_IHTMLControlRange, &LIBID_MSHTML>
00122 {
00123 public:
00124     CIEHtmlControlRange();
00125 
00126 protected:
00127     virtual ~CIEHtmlControlRange();
00128 
00129 public:
00130 
00131 BEGIN_COM_MAP(CIEHtmlControlRange)
00132     COM_INTERFACE_ENTRY(IDispatch)
00133     COM_INTERFACE_ENTRY(IHTMLControlRange)
00134 END_COM_MAP()
00135 
00136     // Implementation of IHTMLControlRange
00137     virtual HRESULT STDMETHODCALLTYPE commonParentElement(IHTMLElement __RPC_FAR *__RPC_FAR *parent);
00138     // Not yet implemented
00139     virtual HRESULT STDMETHODCALLTYPE select( void);
00140     virtual HRESULT STDMETHODCALLTYPE add(IHTMLControlElement __RPC_FAR *item);
00141     virtual HRESULT STDMETHODCALLTYPE remove(long index);
00142     virtual HRESULT STDMETHODCALLTYPE item(long index, IHTMLElement __RPC_FAR *__RPC_FAR *pdisp);
00143     virtual HRESULT STDMETHODCALLTYPE scrollIntoView(VARIANT varargStart);
00144     virtual HRESULT STDMETHODCALLTYPE queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00145     virtual HRESULT STDMETHODCALLTYPE queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00146     virtual HRESULT STDMETHODCALLTYPE queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00147     virtual HRESULT STDMETHODCALLTYPE queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00148     virtual HRESULT STDMETHODCALLTYPE queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText);
00149     virtual HRESULT STDMETHODCALLTYPE queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue);
00150     virtual HRESULT STDMETHODCALLTYPE execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet);
00151     virtual HRESULT STDMETHODCALLTYPE execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet);
00152     virtual HRESULT STDMETHODCALLTYPE get_length(long __RPC_FAR *p);
00153 };
00154 
00155 typedef CComObject<CIEHtmlControlRange> CIEHtmlControlRangeInstance;
00156 
00157 #endif //IEHTMLTXTRANGE_H