LCOV - app.info - objdir/dist/include/nsITextServicesDocument.h

LCOV - code coverage report
| Current view: | directory - objdir/dist/include - nsITextServicesDocument.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 1 | 0 | 0.0 %
| Date: | 2012-06-02 | Functions: | 1 | 0 | 0.0 %

           1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is mozilla.org code.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is
          18                 :  * Netscape Communications Corporation.
          19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
          20                 :  * the Initial Developer. All Rights Reserved.
          21                 :  *
          22                 :  * Contributor(s):
          23                 :  *
          24                 :  * Alternatively, the contents of this file may be used under the terms of
          25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          28                 :  * of those above. If you wish to allow use of your version of this file only
          29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          30                 :  * use your version of this file under the terms of the MPL, indicate your
          31                 :  * decision by deleting the provisions above and replace them with the notice
          32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          33                 :  * the provisions above, a recipient may use your version of this file under
          34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          35                 :  *
          36                 :  * ***** END LICENSE BLOCK ***** */
          37                 :
          38                 : #ifndef nsITextServicesDocument_h__
          39                 : #define nsITextServicesDocument_h__
          40                 :
          41                 : #include "nsISupports.h"
          42                 :
          43                 : class nsIDOMDocument;
          44                 : class nsIDOMRange;
          45                 : class nsIEditor;
          46                 : class nsString;
          47                 : class nsITextServicesFilter;
          48                 :
          49                 : /*
          50                 : TextServicesDocument interface to outside world
          51                 : */
          52                 :
          53                 : #define NS_ITEXTSERVICESDOCUMENT_IID            \
          54                 : { /* 019718E1-CDB5-11d2-8D3C-000000000000 */    \
          55                 : 0x019718e1, 0xcdb5, 0x11d2,                     \
          56                 : { 0x8d, 0x3c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
          57                 :
          58                 :
          59                 : /**
          60                 :  * The nsITextServicesDocument presents the document in as a
          61                 :  * bunch of flattened text blocks. Each text block can be retrieved
          62                 :  * as an nsString (array of characters).
          63                 :  */
          64               0 : class nsITextServicesDocument  : public nsISupports{
          65                 : public:
          66                 :
          67                 :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITEXTSERVICESDOCUMENT_IID)
          68                 :
          69                 :   typedef enum { eDSNormal=0, eDSUndlerline } TSDDisplayStyle;
          70                 :
          71                 :   typedef enum { eBlockNotFound=0, // There is no text block (TB) in or before the selection (S).
          72                 :                  eBlockOutside,    // No TB in S, but found one before/after S.
          73                 :                  eBlockInside,     // S extends beyond the start and end of TB.
          74                 :                  eBlockContains,   // TB contains entire S.
          75                 :                  eBlockPartial     // S begins or ends in TB but extends outside of TB.
          76                 :   } TSDBlockSelectionStatus;
          77                 :
          78                 :   /**
          79                 :    * Get the DOM document for the document in use.
          80                 :    * @return aDocument the dom document [OUT]
          81                 :    */
          82                 :   NS_IMETHOD GetDocument(nsIDOMDocument **aDocument) = 0;
          83                 :
          84                 :   /**
          85                 :    * Initializes the text services document to use a particular
          86                 :    * editor. The text services document will use the DOM document
          87                 :    * and presentation shell used by the editor.
          88                 :    * @param aEditor is the editor to use. The editor is AddRef'd
          89                 :    * by this method.
          90                 :    */
          91                 :   NS_IMETHOD InitWithEditor(nsIEditor *aEditor) = 0;
          92                 :
          93                 :   /**
          94                 :    * Sets the range/extent over which the text services document
          95                 :    * will iterate. Note that InitWithEditor() should have been called prior to
          96                 :    * calling this method. If this method is never called, the text services
          97                 :    * defaults to iterating over the entire document.
          98                 :    *
          99                 :    * @param aDOMRange is the range to use. aDOMRange must point to a
         100                 :    * valid range object.
         101                 :    */
         102                 :   NS_IMETHOD SetExtent(nsIDOMRange* aDOMRange) = 0;
         103                 :
         104                 :   /**
         105                 :    * Expands the end points of the range so that it spans complete words.
         106                 :    * This call does not change any internal state of the text services document.
         107                 :    *
         108                 :    * @param aDOMRange the range to be expanded/adjusted.
         109                 :    */
         110                 :   NS_IMETHOD ExpandRangeToWordBoundaries(nsIDOMRange *aRange) = 0;
         111                 :
         112                 :   /**
         113                 :    * Sets the filter to be used while iterating over content.
         114                 :    * @param aFilter filter to be used while iterating over content.
         115                 :    */
         116                 :   NS_IMETHOD SetFilter(nsITextServicesFilter *aFilter) = 0;
         117                 :
         118                 :   /**
         119                 :    * Returns the text in the current text block.
         120                 :    * @param aStr will contain the text.
         121                 :    */
         122                 :
         123                 :   NS_IMETHOD GetCurrentTextBlock(nsString *aStr) = 0;
         124                 :
         125                 :   /**
         126                 :    * Tells the document to point to the first text block
         127                 :    * in the document. This method does not adjust the current
         128                 :    * cursor position or selection.
         129                 :    */
         130                 :
         131                 :   NS_IMETHOD FirstBlock() = 0;
         132                 :
         133                 :   /**
         134                 :    * Tells the document to point to the last text block that
         135                 :    * contains the current selection or caret.
         136                 :    * @param aSelectionStatus will contain the text block selection status
         137                 :    * @param aSelectionOffset will contain the offset into the
         138                 :    * string returned by GetCurrentTextBlock() where the selection
         139                 :    * begins.
         140                 :    * @param aLength will contain the number of characters that are
         141                 :    * selected in the string.
         142                 :    */
         143                 :
         144                 :   NS_IMETHOD LastSelectedBlock(TSDBlockSelectionStatus *aSelectionStatus, PRInt32 *aSelectionOffset, PRInt32 *aSelectionLength) = 0;
         145                 :
         146                 :   /**
         147                 :    * Tells the document to point to the text block before
         148                 :    * the current one. This method will return NS_OK, even
         149                 :    * if there is no previous block. Callers should call IsDone()
         150                 :    * to check if we have gone beyond the first text block in
         151                 :    * the document.
         152                 :    */
         153                 :
         154                 :   NS_IMETHOD PrevBlock() = 0;
         155                 :
         156                 :   /**
         157                 :    * Tells the document to point to the text block after
         158                 :    * the current one. This method will return NS_OK, even
         159                 :    * if there is no next block. Callers should call IsDone()
         160                 :    * to check if we have gone beyond the last text block
         161                 :    * in the document.
         162                 :    */
         163                 :
         164                 :   NS_IMETHOD NextBlock() = 0;
         165                 :
         166                 :   /**
         167                 :    * IsDone() will always set aIsDone == false unless
         168                 :    * the document contains no text, PrevBlock() was called
         169                 :    * while the document was already pointing to the first
         170                 :    * text block in the document, or NextBlock() was called
         171                 :    * while the document was already pointing to the last
         172                 :    * text block in the document.
         173                 :    * @param aIsDone will contain the result.
         174                 :    */
         175                 :
         176                 :   NS_IMETHOD IsDone(bool *aIsDone) = 0;
         177                 :
         178                 :   /**
         179                 :    * SetSelection() allows the caller to set the selection
         180                 :    * based on an offset into the string returned by
         181                 :    * GetCurrentTextBlock(). A length of zero places the cursor
         182                 :    * at that offset. A positive non-zero length "n" selects
         183                 :    * n characters in the string.
         184                 :    * @param aOffset offset into string returned by GetCurrentTextBlock().
         185                 :    * @param aLength number characters selected.
         186                 :    */
         187                 :
         188                 :   NS_IMETHOD SetSelection(PRInt32 aOffset, PRInt32 aLength) = 0;
         189                 :
         190                 :   /**
         191                 :    * Scrolls the document so that the current selection is visible.
         192                 :    */
         193                 :
         194                 :   NS_IMETHOD ScrollSelectionIntoView() = 0;
         195                 :
         196                 :   /**
         197                 :    * Deletes the text selected by SetSelection(). Calling
         198                 :    * DeleteSelection with nothing selected, or with a collapsed
         199                 :    * selection (cursor) does nothing and returns NS_OK.
         200                 :    */
         201                 :
         202                 :   NS_IMETHOD DeleteSelection() = 0;
         203                 :
         204                 :   /**
         205                 :    * Inserts the given text at the current cursor position.
         206                 :    * If there is a selection, it will be deleted before the
         207                 :    * text is inserted.
         208                 :    */
         209                 :
         210                 :   NS_IMETHOD InsertText(const nsString *aText) = 0;
         211                 : };
         212                 :
         213                 : NS_DEFINE_STATIC_IID_ACCESSOR(nsITextServicesDocument,
         214                 :                               NS_ITEXTSERVICESDOCUMENT_IID)
         215                 :
         216                 : #endif // nsITextServicesDocument_h__
         217                 :

Generated by: LCOV version 1.7