home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CPasteSnooper.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.4 KB  |  64 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. // ===========================================================================
  20. //    CPasteSnooper.h
  21. //    an attachment for filtering characters from a paste command
  22. // ===========================================================================
  23.  
  24. #pragma once
  25.  
  26. #include <LAttachment.h>
  27.  
  28. class CStr31;
  29.  
  30. #define ONLY_TAKE_FIRST_LINE    "\r\n", "\f\f"
  31. #define MAKE_RETURNS_SPACES        "\r\n", "  "
  32. #define DELETE_RETURNS            "\r\n", "\b\b"
  33.  
  34. class CPasteSnooper : public LAttachment {
  35. public:
  36.  
  37.                     // inFind is a pascal string of characters that you
  38.                     // don't want to allow the user to paste. inReplace is
  39.                     // a pascal string of characters to replace the inFind
  40.                     // characters with. ie every instance of inFind[1] is
  41.                     // replaced with inReplace[1]. to specify that a certain
  42.                     // character is to be simply deleted, put the character in
  43.                     // inFind at any location i and set inReplace[i] to
  44.                     // '\b'. The '\b' code is reserved for deleting characters
  45.                     // A '\f' in inReplace[i] means that we only take characters up
  46.                     // to the first occurence of inFind[i] and discard everything
  47.                     // after that. \a in inReplace[i] means that leading occurences
  48.                     // of inFind[i] should be stripped
  49.                     CPasteSnooper (char *inFind, char *inReplace);
  50.             
  51.     virtual            ~CPasteSnooper ();
  52.  
  53. protected:
  54.     // characters that we're not allowing the user to paste
  55.     char            *mFind;
  56.     // characters used to replace those found in mFilter. '\b' if
  57.     // we're supposed to delete a char rather than replace it
  58.     char            *mReplace;
  59.     
  60. protected:    
  61.                     // this creates a CPasteActionSnooper to really do the paste
  62.     virtual    void    ExecuteSelf (MessageT inMessage, void *ioParam);
  63. };
  64.