2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-10-20 00:17:17 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1998-10-20 00:17:17 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-10-20 00:17:17 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-10-20 00:17:17 +00:00
|
|
|
#ifndef nsTextTransformer_h___
|
|
|
|
#define nsTextTransformer_h___
|
|
|
|
|
|
|
|
#include "nsTextFragment.h"
|
|
|
|
#include "nsISupports.h"
|
2000-09-20 23:00:32 +00:00
|
|
|
#include "nsIPresContext.h"
|
2002-06-11 21:00:20 +00:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
#include "nsBidi.h"
|
|
|
|
#include "nsBidiUtils.h"
|
|
|
|
#endif
|
1998-10-20 00:17:17 +00:00
|
|
|
|
1999-09-16 23:31:59 +00:00
|
|
|
class nsIContent;
|
1998-10-20 00:17:17 +00:00
|
|
|
class nsIFrame;
|
1999-02-24 18:21:23 +00:00
|
|
|
class nsILineBreaker;
|
1999-04-06 22:41:44 +00:00
|
|
|
class nsIWordBreaker;
|
1998-10-20 00:17:17 +00:00
|
|
|
|
1999-11-01 15:32:37 +00:00
|
|
|
// XXX I'm sure there are other special characters
|
|
|
|
#define CH_NBSP 160
|
2000-08-24 21:13:18 +00:00
|
|
|
#define CH_ENSP 8194 //<!ENTITY ensp CDATA " " -- en space, U+2002 ISOpub -->
|
|
|
|
#define CH_EMSP 8195 //<!ENTITY emsp CDATA " " -- em space, U+2003 ISOpub -->
|
|
|
|
#define CH_THINSP 8291 //<!ENTITY thinsp CDATA " " -- thin space, U+2009 ISOpub -->
|
|
|
|
#define CH_ZWNJ 8204 //<!ENTITY zwnj CDATA "‌" -- zero width non-joiner, U+200C NEW RFC 2070#define CH_SHY 173
|
1999-11-01 15:32:37 +00:00
|
|
|
#define CH_SHY 173
|
|
|
|
|
2001-11-14 14:21:52 +00:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
#define CH_ZWJ 8205 //<!ENTITY zwj CDATA "‍" -- zero width joiner, U+200D NEW RFC 2070 -->
|
|
|
|
#define CH_LRM 8206 //<!ENTITY lrm CDATA "‎" -- left-to-right mark, U+200E NEW RFC 2070 -->
|
|
|
|
#define CH_RLM 8207 //<!ENTITY rlm CDATA "‏" -- right-to-left mark, U+200F NEW RFC 2070 -->
|
|
|
|
#define CH_LRE 8234 //<!CDATA "‪" -- left-to-right embedding, U+202A -->
|
|
|
|
#define CH_RLE 8235 //<!CDATA "‫" -- right-to-left embedding, U+202B -->
|
|
|
|
#define CH_PDF 8236 //<!CDATA "‬" -- pop directional format, U+202C -->
|
|
|
|
#define CH_LRO 8237 //<!CDATA "‭" -- left-to-right override, U+202D -->
|
|
|
|
#define CH_RLO 8238 //<!CDATA "‮" -- right-to-left override, U+202E -->
|
|
|
|
|
|
|
|
#define IS_BIDI_CONTROL(_ch) \
|
2002-04-23 23:50:17 +00:00
|
|
|
(((_ch) >= CH_LRM && (_ch) <= CH_RLM) \
|
2001-11-14 14:21:52 +00:00
|
|
|
|| ((_ch) >= CH_LRE && (_ch) <= CH_RLO))
|
|
|
|
#endif // IBMBIDI
|
|
|
|
|
2003-01-09 20:56:53 +00:00
|
|
|
#define IS_ASCII_CHAR(ch) ((ch&0xff80) == 0)
|
|
|
|
|
2000-09-12 00:00:58 +00:00
|
|
|
#define NS_TEXT_TRANSFORMER_AUTO_WORD_BUF_SIZE 128 // used to be 256
|
|
|
|
|
|
|
|
// Indicates whether the transformed text should be left as ascii
|
|
|
|
#define NS_TEXT_TRANSFORMER_LEAVE_AS_ASCII 1
|
|
|
|
|
|
|
|
// If at any point during GetNextWord or GetPrevWord we
|
|
|
|
// run across a multibyte (> 127) unicode character.
|
|
|
|
#define NS_TEXT_TRANSFORMER_HAS_MULTIBYTE 2
|
|
|
|
|
|
|
|
// The text in the transform buffer is ascii
|
|
|
|
#define NS_TEXT_TRANSFORMER_TRANSFORMED_TEXT_IS_ASCII 4
|
1999-09-22 00:40:16 +00:00
|
|
|
|
2002-06-11 21:00:20 +00:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
// The text in the transform buffer needs Arabic shaping
|
|
|
|
#define NS_TEXT_TRANSFORMER_DO_ARABIC_SHAPING 8
|
|
|
|
|
|
|
|
// The text in the transform buffer needs numeric shaping
|
|
|
|
#define NS_TEXT_TRANSFORMER_DO_NUMERIC_SHAPING 16
|
|
|
|
#endif
|
|
|
|
|
1999-10-19 23:01:45 +00:00
|
|
|
// A growable text buffer that tries to avoid using malloc by having a
|
|
|
|
// builtin buffer. Ideally used as an automatic variable.
|
|
|
|
class nsAutoTextBuffer {
|
|
|
|
public:
|
|
|
|
nsAutoTextBuffer();
|
|
|
|
~nsAutoTextBuffer();
|
|
|
|
|
|
|
|
nsresult GrowBy(PRInt32 aAtLeast, PRBool aCopyToHead = PR_TRUE);
|
|
|
|
|
|
|
|
nsresult GrowTo(PRInt32 aNewSize, PRBool aCopyToHead = PR_TRUE);
|
|
|
|
|
|
|
|
PRUnichar* GetBuffer() { return mBuffer; }
|
|
|
|
PRUnichar* GetBufferEnd() { return mBuffer + mBufferLen; }
|
|
|
|
PRInt32 GetBufferLength() const { return mBufferLen; }
|
|
|
|
|
|
|
|
PRUnichar* mBuffer;
|
|
|
|
PRInt32 mBufferLen;
|
|
|
|
PRUnichar mAutoBuffer[NS_TEXT_TRANSFORMER_AUTO_WORD_BUF_SIZE];
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
|
1998-10-20 00:17:17 +00:00
|
|
|
/**
|
|
|
|
* This object manages the transformation of text:
|
|
|
|
*
|
|
|
|
* <UL>
|
|
|
|
* <LI>whitespace compression
|
|
|
|
* <LI>capitalization
|
|
|
|
* <LI>lowercasing
|
|
|
|
* <LI>uppercasing
|
2000-04-12 14:54:43 +00:00
|
|
|
* <LI>ascii to Unicode (if requested)
|
2000-04-04 14:14:47 +00:00
|
|
|
* <LI>discarded characters
|
|
|
|
* <LI>conversion of   that is not part of whitespace into a space
|
2000-04-12 14:54:43 +00:00
|
|
|
* <LI>tab and newline characters to space (normal text only)
|
1998-10-20 00:17:17 +00:00
|
|
|
* </UL>
|
|
|
|
*
|
|
|
|
* Note that no transformations are applied that would impact word
|
|
|
|
* breaking (like mapping into space, for example). In
|
|
|
|
* addition, this logic will not strip leading or trailing whitespace
|
|
|
|
* (across the entire run of text; leading whitespace can be skipped
|
|
|
|
* for a frames text because of whitespace compression).
|
|
|
|
*/
|
|
|
|
class nsTextTransformer {
|
|
|
|
public:
|
1999-09-22 00:40:16 +00:00
|
|
|
// Note: The text transformer does not hold a reference to the line
|
|
|
|
// breaker and work breaker objects
|
|
|
|
nsTextTransformer(nsILineBreaker* aLineBreaker,
|
2000-09-20 23:00:32 +00:00
|
|
|
nsIWordBreaker* aWordBreaker,
|
|
|
|
nsIPresContext* aPresContext);
|
1999-02-24 18:21:23 +00:00
|
|
|
|
1998-10-20 00:17:17 +00:00
|
|
|
~nsTextTransformer();
|
|
|
|
|
|
|
|
/**
|
2000-04-04 14:14:47 +00:00
|
|
|
* Initialize the text transform. Use GetNextWord() and GetPrevWord()
|
|
|
|
* to iterate the text
|
2000-04-12 14:54:43 +00:00
|
|
|
*
|
|
|
|
* The default is to transform all text to Unicode; however, you can
|
|
|
|
* specify that the text should be left as ascii if possible. Note that
|
|
|
|
* we don't step the text down from Unicode to ascii (even if it doesn't
|
|
|
|
* contain multibyte characters) so this only happens for text fragments
|
|
|
|
* that contain 1-byte text.
|
|
|
|
* XXX This is currently not implemented for GetPreviousWord()
|
|
|
|
* @see TransformedTextIsAscii()
|
1998-10-20 00:17:17 +00:00
|
|
|
*/
|
1999-09-16 23:31:59 +00:00
|
|
|
nsresult Init(nsIFrame* aFrame,
|
|
|
|
nsIContent* aContent,
|
2000-04-12 14:54:43 +00:00
|
|
|
PRInt32 aStartingOffset,
|
2003-03-07 20:56:03 +00:00
|
|
|
PRBool aForceArabicShaping = PR_FALSE,
|
2000-04-12 14:54:43 +00:00
|
|
|
PRBool aLeaveAsAscii = PR_FALSE);
|
1998-10-20 00:17:17 +00:00
|
|
|
|
|
|
|
PRInt32 GetContentLength() const {
|
1999-10-19 23:01:45 +00:00
|
|
|
return mFrag ? mFrag->GetLength() : 0;
|
1998-10-20 00:17:17 +00:00
|
|
|
}
|
|
|
|
|
2000-04-04 14:14:47 +00:00
|
|
|
/**
|
|
|
|
* Iterates the next word in the text fragment.
|
|
|
|
*
|
|
|
|
* Returns a pointer to the word, the number of characters in the word, the
|
2000-04-12 14:54:43 +00:00
|
|
|
* content length of the word, whether it is whitespace, and whether the
|
|
|
|
* text was transformed (any of the transformations listed above). The content
|
|
|
|
* length can be greater than the word length if whitespace compression occured
|
|
|
|
* or if characters were discarded
|
2000-04-04 14:14:47 +00:00
|
|
|
*
|
|
|
|
* The default behavior is to reset the transform buffer to the beginning,
|
|
|
|
* but you can choose to not reste it and buffer across multiple words
|
|
|
|
*/
|
1998-10-20 16:45:14 +00:00
|
|
|
PRUnichar* GetNextWord(PRBool aInWord,
|
1999-10-19 23:01:45 +00:00
|
|
|
PRInt32* aWordLenResult,
|
|
|
|
PRInt32* aContentLenResult,
|
|
|
|
PRBool* aIsWhitespaceResult,
|
2000-04-12 14:54:43 +00:00
|
|
|
PRBool* aWasTransformed,
|
2000-04-04 14:14:47 +00:00
|
|
|
PRBool aResetTransformBuf = PR_TRUE,
|
2003-01-09 20:56:53 +00:00
|
|
|
PRBool aForLineBreak = PR_TRUE,
|
|
|
|
PRBool aIsKeyboardSelect = PR_FALSE);
|
1998-10-20 00:17:17 +00:00
|
|
|
|
1999-02-22 03:20:59 +00:00
|
|
|
PRUnichar* GetPrevWord(PRBool aInWord,
|
1999-10-19 23:01:45 +00:00
|
|
|
PRInt32* aWordLenResult,
|
|
|
|
PRInt32* aContentLenResult,
|
|
|
|
PRBool* aIsWhitespaceResult,
|
2003-01-09 20:56:53 +00:00
|
|
|
PRBool aForLineBreak = PR_TRUE,
|
|
|
|
PRBool aIsKeyboardSelect = PR_FALSE);
|
1999-10-19 23:01:45 +00:00
|
|
|
|
2000-09-12 00:00:58 +00:00
|
|
|
|
|
|
|
// Returns PR_TRUE if the LEAVE_AS_ASCII flag is set
|
|
|
|
PRBool LeaveAsAscii() const {
|
2002-06-11 21:00:20 +00:00
|
|
|
return (mFlags & NS_TEXT_TRANSFORMER_LEAVE_AS_ASCII) != 0;
|
2000-09-12 00:00:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns PR_TRUE if any of the characters are multibyte (greater than 127)
|
1998-10-20 00:17:17 +00:00
|
|
|
PRBool HasMultibyte() const {
|
2002-06-11 21:00:20 +00:00
|
|
|
return (mFlags & NS_TEXT_TRANSFORMER_HAS_MULTIBYTE) != 0;
|
1998-10-20 00:17:17 +00:00
|
|
|
}
|
|
|
|
|
2000-09-12 00:00:58 +00:00
|
|
|
// Returns PR_TRUE if the text in the transform bufer is ascii (i.e., it
|
|
|
|
// doesn't contain any multibyte characters)
|
2000-04-12 14:54:43 +00:00
|
|
|
PRBool TransformedTextIsAscii() const {
|
2002-06-11 21:00:20 +00:00
|
|
|
return (mFlags & NS_TEXT_TRANSFORMER_TRANSFORMED_TEXT_IS_ASCII) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef IBMBIDI
|
|
|
|
// Returns PR_TRUE if the text in the transform bufer needs Arabic
|
|
|
|
// shaping
|
|
|
|
PRBool NeedsArabicShaping() const {
|
|
|
|
return (mFlags & NS_TEXT_TRANSFORMER_DO_ARABIC_SHAPING) != 0;
|
2000-09-12 00:00:58 +00:00
|
|
|
}
|
2002-06-11 21:00:20 +00:00
|
|
|
|
|
|
|
// Returns PR_TRUE if the text in the transform bufer needs numeric
|
|
|
|
// shaping
|
|
|
|
PRBool NeedsNumericShaping() const {
|
|
|
|
return (mFlags & NS_TEXT_TRANSFORMER_DO_NUMERIC_SHAPING) != 0;
|
|
|
|
}
|
|
|
|
#endif
|
2000-09-12 00:00:58 +00:00
|
|
|
|
|
|
|
// Set or clears the LEAVE_AS_ASCII bit
|
|
|
|
void SetLeaveAsAscii(PRBool aValue) {
|
|
|
|
aValue ? mFlags |= NS_TEXT_TRANSFORMER_LEAVE_AS_ASCII :
|
|
|
|
mFlags &= (~NS_TEXT_TRANSFORMER_LEAVE_AS_ASCII);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set or clears the NS_TEXT_TRANSFORMER_HAS_MULTIBYTE bit
|
|
|
|
void SetHasMultibyte(PRBool aValue) {
|
|
|
|
aValue ? mFlags |= NS_TEXT_TRANSFORMER_HAS_MULTIBYTE :
|
|
|
|
mFlags &= (~NS_TEXT_TRANSFORMER_HAS_MULTIBYTE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set or clears the NS_TEXT_TRANSFORMER_TRANSFORMED_TEXT_IS_ASCII bit
|
|
|
|
void SetTransformedTextIsAscii(PRBool aValue) {
|
|
|
|
aValue ? mFlags |= NS_TEXT_TRANSFORMER_TRANSFORMED_TEXT_IS_ASCII :
|
|
|
|
mFlags &= (~NS_TEXT_TRANSFORMER_TRANSFORMED_TEXT_IS_ASCII);
|
2000-04-12 14:54:43 +00:00
|
|
|
}
|
|
|
|
|
2002-06-11 21:00:20 +00:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
// Set or clears the NS_TEXT_TRANSFORMER_TRANSFORMED_DO_ARABIC_SHAPING bit
|
|
|
|
void SetNeedsArabicShaping(PRBool aValue) {
|
|
|
|
aValue ? mFlags |= NS_TEXT_TRANSFORMER_DO_ARABIC_SHAPING :
|
|
|
|
mFlags &= (~NS_TEXT_TRANSFORMER_DO_ARABIC_SHAPING);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set or clears the NS_TEXT_TRANSFORMER_TRANSFORMED_DO_NUMERIC_SHAPING bit
|
|
|
|
void SetNeedsNumericShaping(PRBool aValue) {
|
|
|
|
aValue ? mFlags |= NS_TEXT_TRANSFORMER_DO_NUMERIC_SHAPING :
|
|
|
|
mFlags &= (~NS_TEXT_TRANSFORMER_DO_NUMERIC_SHAPING);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-09-22 00:40:16 +00:00
|
|
|
PRUnichar* GetWordBuffer() {
|
1999-10-19 23:01:45 +00:00
|
|
|
return mTransformBuf.GetBuffer();
|
1999-09-22 00:40:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32 GetWordBufferLength() const {
|
1999-10-19 23:01:45 +00:00
|
|
|
return mTransformBuf.GetBufferLength();
|
1999-09-22 00:40:16 +00:00
|
|
|
}
|
1998-10-20 00:17:17 +00:00
|
|
|
|
2000-09-12 00:00:58 +00:00
|
|
|
|
1999-10-19 23:01:45 +00:00
|
|
|
static nsresult Initialize();
|
|
|
|
static void Shutdown();
|
1998-10-20 00:17:17 +00:00
|
|
|
|
1999-10-19 23:01:45 +00:00
|
|
|
protected:
|
|
|
|
// Helper methods for GetNextWord (F == forwards)
|
|
|
|
PRInt32 ScanNormalWhiteSpace_F();
|
2000-04-12 14:54:43 +00:00
|
|
|
PRInt32 ScanNormalAsciiText_F(PRInt32* aWordLen,
|
|
|
|
PRBool* aWasTransformed);
|
2000-08-24 21:13:18 +00:00
|
|
|
PRInt32 ScanNormalAsciiText_F_ForWordBreak(PRInt32* aWordLen,
|
2003-01-09 20:56:53 +00:00
|
|
|
PRBool* aWasTransformed,
|
|
|
|
PRBool aIsKeyboardSelect);
|
2000-04-12 14:54:43 +00:00
|
|
|
PRInt32 ScanNormalUnicodeText_F(PRBool aForLineBreak,
|
|
|
|
PRInt32* aWordLen,
|
|
|
|
PRBool* aWasTransformed);
|
1999-10-19 23:01:45 +00:00
|
|
|
PRInt32 ScanPreWrapWhiteSpace_F(PRInt32* aWordLen);
|
2000-04-12 14:54:43 +00:00
|
|
|
PRInt32 ScanPreAsciiData_F(PRInt32* aWordLen,
|
|
|
|
PRBool* aWasTransformed);
|
|
|
|
PRInt32 ScanPreData_F(PRInt32* aWordLen,
|
|
|
|
PRBool* aWasTransformed);
|
1999-10-19 23:01:45 +00:00
|
|
|
|
|
|
|
// Helper methods for GetPrevWord (B == backwards)
|
|
|
|
PRInt32 ScanNormalWhiteSpace_B();
|
2003-01-09 20:56:53 +00:00
|
|
|
PRInt32 ScanNormalAsciiText_B(PRInt32* aWordLen, PRBool aIsKeyboardSelect);
|
1999-10-19 23:01:45 +00:00
|
|
|
PRInt32 ScanNormalUnicodeText_B(PRBool aForLineBreak, PRInt32* aWordLen);
|
|
|
|
PRInt32 ScanPreWrapWhiteSpace_B(PRInt32* aWordLen);
|
|
|
|
PRInt32 ScanPreData_B(PRInt32* aWordLen);
|
|
|
|
|
2000-04-12 14:54:43 +00:00
|
|
|
// Converts the current text in the transform buffer from ascii to
|
|
|
|
// Unicode
|
|
|
|
void ConvertTransformedTextToUnicode();
|
|
|
|
|
2000-09-20 23:00:32 +00:00
|
|
|
void LanguageSpecificTransform(PRUnichar* aText, PRInt32 aLen,
|
|
|
|
PRBool* aWasTransformed);
|
|
|
|
|
2002-06-11 21:00:20 +00:00
|
|
|
void DoArabicShaping(PRUnichar* aText, PRInt32& aTextLength, PRBool* aWasTransformed);
|
|
|
|
|
|
|
|
void DoNumericShaping(PRUnichar* aText, PRInt32& aTextLength, PRBool* aWasTransformed);
|
2003-02-24 21:31:19 +00:00
|
|
|
|
|
|
|
void StripZeroWidthJoinControls(PRUnichar* aSource, PRUnichar* aTarget, PRInt32& aTextLength, PRBool* aWasTransformed);
|
2002-06-11 21:00:20 +00:00
|
|
|
|
1999-10-19 23:01:45 +00:00
|
|
|
// The text fragment that we are looking at
|
1999-10-15 23:36:07 +00:00
|
|
|
const nsTextFragment* mFrag;
|
1998-10-20 00:17:17 +00:00
|
|
|
|
1999-10-19 23:01:45 +00:00
|
|
|
// Our current offset into the text fragment
|
|
|
|
PRInt32 mOffset;
|
|
|
|
|
|
|
|
// The frame's white-space mode we are using to process text
|
|
|
|
enum {
|
|
|
|
eNormal,
|
|
|
|
ePreformatted,
|
|
|
|
ePreWrap
|
|
|
|
} mMode;
|
2000-09-12 00:00:58 +00:00
|
|
|
|
1999-10-19 23:01:45 +00:00
|
|
|
nsILineBreaker* mLineBreaker; // [WEAK]
|
|
|
|
|
|
|
|
nsIWordBreaker* mWordBreaker; // [WEAK]
|
|
|
|
|
2000-09-20 23:00:32 +00:00
|
|
|
nsLanguageSpecificTransformType mLanguageSpecificTransformType;
|
|
|
|
|
2002-06-11 21:00:20 +00:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
nsIPresContext* mPresContext;
|
|
|
|
nsCharType mCharType;
|
|
|
|
#endif
|
|
|
|
|
1999-10-19 23:01:45 +00:00
|
|
|
// Buffer used to hold the transformed words from GetNextWord or
|
|
|
|
// GetPrevWord
|
|
|
|
nsAutoTextBuffer mTransformBuf;
|
|
|
|
|
2000-04-04 14:14:47 +00:00
|
|
|
// Our current position within the buffer. Used when iterating the next
|
|
|
|
// word, because we may be requested to buffer across multiple words
|
|
|
|
PRInt32 mBufferPos;
|
2000-04-12 14:54:43 +00:00
|
|
|
|
|
|
|
// The frame's text-transform state
|
|
|
|
PRUint8 mTextTransform;
|
2000-04-04 14:14:47 +00:00
|
|
|
|
2000-09-12 00:00:58 +00:00
|
|
|
// Flag for controling mLeaveAsAscii, mHasMultibyte, mTransformedTextIsAscii
|
|
|
|
PRUint8 mFlags;
|
|
|
|
|
2001-10-19 14:10:22 +00:00
|
|
|
// prefs used to configure the double-click word selection behavior
|
|
|
|
static PRPackedBool sWordSelectPrefInited; // have we read the prefs yet?
|
|
|
|
static PRPackedBool sWordSelectStopAtPunctuation; // should we stop at punctuation?
|
|
|
|
|
1999-10-19 23:01:45 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
static void SelfTest(nsILineBreaker* aLineBreaker,
|
2000-09-20 23:00:32 +00:00
|
|
|
nsIWordBreaker* aWordBreaker,
|
|
|
|
nsIPresContext* aPresContext);
|
1999-09-22 00:40:16 +00:00
|
|
|
|
1999-10-19 23:01:45 +00:00
|
|
|
nsresult Init2(const nsTextFragment* aFrag,
|
|
|
|
PRInt32 aStartingOffset,
|
|
|
|
PRUint8 aWhiteSpace,
|
|
|
|
PRUint8 aTextTransform);
|
|
|
|
#endif
|
1998-10-20 00:17:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsTextTransformer_h___ */
|