mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Fix flipping of Arabic text when pasted to clipboard. Bug 197375, r+sr=bzbarsky
This commit is contained in:
parent
deeca5d835
commit
e1f6e10871
@ -138,58 +138,6 @@ nsresult nsCopySupport::HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef IBMBIDI //ahmed
|
||||
rv = NS_OK;
|
||||
PRBool arabicCharset;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
|
||||
if (doc) {
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context) );
|
||||
if (context) {
|
||||
context->IsArabicEncoding(arabicCharset);
|
||||
if (arabicCharset) {
|
||||
PRUint32 bidiOptions;
|
||||
PRBool isBidiSystem = context->IsBidiSystem();
|
||||
PRBool isVisual = context->IsVisualMode();
|
||||
|
||||
context->GetBidi(&bidiOptions);
|
||||
if ( (GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions) == IBMBIDI_CLIPBOARDTEXTMODE_LOGICAL)&&(isVisual)
|
||||
) {
|
||||
nsAutoString newBuffer;
|
||||
if (isBidiSystem) {
|
||||
if (GET_BIDI_OPTION_DIRECTION(bidiOptions) == IBMBIDI_TEXTDIRECTION_RTL) {
|
||||
Conv_FE_06(buffer, newBuffer);
|
||||
}
|
||||
else {
|
||||
Conv_FE_06_WithReverse(buffer, newBuffer);
|
||||
}
|
||||
}
|
||||
else { //nonbidisystem
|
||||
HandleNumbers(buffer, newBuffer);//ahmed
|
||||
}
|
||||
buffer = newBuffer;
|
||||
}
|
||||
//Mohamed
|
||||
else {
|
||||
nsCAutoString bidiCharset;
|
||||
context->GetBidiCharset(bidiCharset);
|
||||
if (bidiCharset.EqualsIgnoreCase("UTF-8") || (!isVisual)) {
|
||||
if ( (GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions) == IBMBIDI_CLIPBOARDTEXTMODE_VISUAL) || (!isBidiSystem) ) {
|
||||
nsAutoString newBuffer;
|
||||
Conv_06_FE_WithReverse(buffer, newBuffer, GET_BIDI_OPTION_DIRECTION(bidiOptions));
|
||||
HandleNumbers(newBuffer, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // IBMBIDI
|
||||
|
||||
// Get the Clipboard
|
||||
nsCOMPtr<nsIClipboard> clipboard(do_GetService(kCClipboardCID, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -2567,27 +2567,6 @@ NS_IMETHODIMP DocumentViewerImpl::GetBidiControlsTextMode(PRUint8* aControlsText
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DocumentViewerImpl::SetBidiClipboardTextMode(PRUint8 aClipboardTextMode)
|
||||
{
|
||||
PRUint32 bidiOptions;
|
||||
|
||||
GetBidiOptions(&bidiOptions);
|
||||
SET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions, aClipboardTextMode);
|
||||
SetBidiOptions(bidiOptions);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DocumentViewerImpl::GetBidiClipboardTextMode(PRUint8* aClipboardTextMode)
|
||||
{
|
||||
PRUint32 bidiOptions;
|
||||
|
||||
if (aClipboardTextMode) {
|
||||
GetBidiOptions(&bidiOptions);
|
||||
*aClipboardTextMode = GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DocumentViewerImpl::SetBidiNumeral(PRUint8 aNumeral)
|
||||
{
|
||||
PRUint32 bidiOptions;
|
||||
|
@ -117,7 +117,6 @@
|
||||
#define IBMBIDI_TEXTDIRECTION_STR "bidi.direction"
|
||||
#define IBMBIDI_TEXTTYPE_STR "bidi.texttype"
|
||||
#define IBMBIDI_CONTROLSTEXTMODE_STR "bidi.controlstextmode"
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE_STR "bidi.clipboardtextmode"
|
||||
#define IBMBIDI_NUMERAL_STR "bidi.numeral"
|
||||
#define IBMBIDI_SUPPORTMODE_STR "bidi.support"
|
||||
#define IBMBIDI_CHARSET_STR "bidi.characterset"
|
||||
@ -125,10 +124,9 @@
|
||||
#define IBMBIDI_TEXTDIRECTION 1
|
||||
#define IBMBIDI_TEXTTYPE 2
|
||||
#define IBMBIDI_CONTROLSTEXTMODE 3
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE 4
|
||||
#define IBMBIDI_NUMERAL 5
|
||||
#define IBMBIDI_SUPPORTMODE 6
|
||||
#define IBMBIDI_CHARSET 7
|
||||
#define IBMBIDI_NUMERAL 4
|
||||
#define IBMBIDI_SUPPORTMODE 5
|
||||
#define IBMBIDI_CHARSET 6
|
||||
|
||||
// ------------------
|
||||
// Text Direction
|
||||
@ -151,13 +149,6 @@
|
||||
#define IBMBIDI_CONTROLSTEXTMODE_VISUAL 2 // 2 = visualcontrolstextmodeBidi
|
||||
#define IBMBIDI_CONTROLSTEXTMODE_CONTAINER 3 // 3 = containercontrolstextmodeBidi
|
||||
// ------------------
|
||||
// Clipboard Text Mode
|
||||
// ------------------
|
||||
// bidi.clipboardtextmode
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE_LOGICAL 1 // 1 = logicalclipboardtextmodeBidi
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE_VISUAL 2 // 2 = visualclipboardtextmodeBidi
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE_SOURCE 3 // 3 = sourceclipboardtextmodeBidi *
|
||||
// ------------------
|
||||
// Numeral Style
|
||||
// ------------------
|
||||
// bidi.numeral
|
||||
@ -184,27 +175,24 @@
|
||||
((IBMBIDI_TEXTDIRECTION_LTR<<0) | \
|
||||
(IBMBIDI_TEXTTYPE_CHARSET<<4) | \
|
||||
(IBMBIDI_CONTROLSTEXTMODE_LOGICAL<<8) | \
|
||||
(IBMBIDI_CLIPBOARDTEXTMODE_SOURCE<<12) | \
|
||||
(IBMBIDI_NUMERAL_NOMINAL<<16) | \
|
||||
(IBMBIDI_SUPPORTMODE_MOZILLA<<20) | \
|
||||
(IBMBIDI_CHARSET_BIDI<<24))
|
||||
(IBMBIDI_NUMERAL_NOMINAL<<12) | \
|
||||
(IBMBIDI_SUPPORTMODE_MOZILLA<<16) | \
|
||||
(IBMBIDI_CHARSET_BIDI<<20))
|
||||
|
||||
|
||||
#define GET_BIDI_OPTION_DIRECTION(bo) (((bo)>>0) & 0x0000000F) /* 4 bits for DIRECTION */
|
||||
#define GET_BIDI_OPTION_TEXTTYPE(bo) (((bo)>>4) & 0x0000000F) /* 4 bits for TEXTTYPE */
|
||||
#define GET_BIDI_OPTION_CONTROLSTEXTMODE(bo) (((bo)>>8) & 0x0000000F) /* 4 bits for CONTROLTEXTMODE */
|
||||
#define GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bo) (((bo)>>12) & 0x0000000F) /* 4 bits for CLIPBOARDTEXTMODE */
|
||||
#define GET_BIDI_OPTION_NUMERAL(bo) (((bo)>>16) & 0x0000000F) /* 4 bits for NUMERAL */
|
||||
#define GET_BIDI_OPTION_SUPPORT(bo) (((bo)>>20) & 0x0000000F) /* 4 bits for SUPPORT */
|
||||
#define GET_BIDI_OPTION_CHARACTERSET(bo) (((bo)>>24) & 0x0000000F) /* 4 bits for CHARACTERSET */
|
||||
#define GET_BIDI_OPTION_NUMERAL(bo) (((bo)>>12) & 0x0000000F) /* 4 bits for NUMERAL */
|
||||
#define GET_BIDI_OPTION_SUPPORT(bo) (((bo)>>16) & 0x0000000F) /* 4 bits for SUPPORT */
|
||||
#define GET_BIDI_OPTION_CHARACTERSET(bo) (((bo)>>20) & 0x0000000F) /* 4 bits for CHARACTERSET */
|
||||
|
||||
#define SET_BIDI_OPTION_DIRECTION(bo, dir) {(bo)=((bo) & 0xFFFFFFF0)|(((dir)& 0x0000000F)<<0);}
|
||||
#define SET_BIDI_OPTION_TEXTTYPE(bo, tt) {(bo)=((bo) & 0xFFFFFF0F)|(((tt)& 0x0000000F)<<4);}
|
||||
#define SET_BIDI_OPTION_CONTROLSTEXTMODE(bo, cotm) {(bo)=((bo) & 0xFFFFF0FF)|(((cotm)& 0x0000000F)<<8);}
|
||||
#define SET_BIDI_OPTION_CLIPBOARDTEXTMODE(bo, cltm) {(bo)=((bo) & 0xFFFF0FFF)|(((cltm)& 0x0000000F)<<12);}
|
||||
#define SET_BIDI_OPTION_NUMERAL(bo, num) {(bo)=((bo) & 0xFFF0FFFF)|(((num)& 0x0000000F)<<16);}
|
||||
#define SET_BIDI_OPTION_SUPPORT(bo, sup) {(bo)=((bo) & 0xFF0FFFFF)|(((sup)& 0x0000000F)<<20);}
|
||||
#define SET_BIDI_OPTION_CHARACTERSET(bo, cs) {(bo)=((bo) & 0xF0FFFFFF)|(((cs)& 0x0000000F)<<24);}
|
||||
#define SET_BIDI_OPTION_NUMERAL(bo, num) {(bo)=((bo) & 0xFFFF0FFF)|(((num)& 0x0000000F)<<12);}
|
||||
#define SET_BIDI_OPTION_SUPPORT(bo, sup) {(bo)=((bo) & 0xFFF0FFFF)|(((sup)& 0x0000000F)<<16);}
|
||||
#define SET_BIDI_OPTION_CHARACTERSET(bo, cs) {(bo)=((bo) & 0xFF0FFFFF)|(((cs)& 0x0000000F)<<20);}
|
||||
|
||||
/* Constants related to the position of numerics in the codepage */
|
||||
#define START_HINDI_DIGITS 0x0660
|
||||
|
@ -130,14 +130,6 @@ interface nsIMarkupDocumentViewer : nsISupports
|
||||
*/
|
||||
attribute octet bidiControlsTextMode;
|
||||
|
||||
/**
|
||||
* bidiClipboardTextMode: the order in which text is transferred to the clipboard.
|
||||
* 1 - logical
|
||||
* 2 - visual
|
||||
* 3 - as source (unchanged)
|
||||
*/
|
||||
attribute octet bidiClipboardTextMode;
|
||||
|
||||
/**
|
||||
* bidiNumeral: the type of numerals to display.
|
||||
* 1 - depending on context, default is Arabic numerals
|
||||
|
@ -117,7 +117,6 @@
|
||||
#define IBMBIDI_TEXTDIRECTION_STR "bidi.direction"
|
||||
#define IBMBIDI_TEXTTYPE_STR "bidi.texttype"
|
||||
#define IBMBIDI_CONTROLSTEXTMODE_STR "bidi.controlstextmode"
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE_STR "bidi.clipboardtextmode"
|
||||
#define IBMBIDI_NUMERAL_STR "bidi.numeral"
|
||||
#define IBMBIDI_SUPPORTMODE_STR "bidi.support"
|
||||
#define IBMBIDI_CHARSET_STR "bidi.characterset"
|
||||
@ -125,10 +124,9 @@
|
||||
#define IBMBIDI_TEXTDIRECTION 1
|
||||
#define IBMBIDI_TEXTTYPE 2
|
||||
#define IBMBIDI_CONTROLSTEXTMODE 3
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE 4
|
||||
#define IBMBIDI_NUMERAL 5
|
||||
#define IBMBIDI_SUPPORTMODE 6
|
||||
#define IBMBIDI_CHARSET 7
|
||||
#define IBMBIDI_NUMERAL 4
|
||||
#define IBMBIDI_SUPPORTMODE 5
|
||||
#define IBMBIDI_CHARSET 6
|
||||
|
||||
// ------------------
|
||||
// Text Direction
|
||||
@ -151,13 +149,6 @@
|
||||
#define IBMBIDI_CONTROLSTEXTMODE_VISUAL 2 // 2 = visualcontrolstextmodeBidi
|
||||
#define IBMBIDI_CONTROLSTEXTMODE_CONTAINER 3 // 3 = containercontrolstextmodeBidi
|
||||
// ------------------
|
||||
// Clipboard Text Mode
|
||||
// ------------------
|
||||
// bidi.clipboardtextmode
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE_LOGICAL 1 // 1 = logicalclipboardtextmodeBidi
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE_VISUAL 2 // 2 = visualclipboardtextmodeBidi
|
||||
#define IBMBIDI_CLIPBOARDTEXTMODE_SOURCE 3 // 3 = sourceclipboardtextmodeBidi *
|
||||
// ------------------
|
||||
// Numeral Style
|
||||
// ------------------
|
||||
// bidi.numeral
|
||||
@ -184,27 +175,24 @@
|
||||
((IBMBIDI_TEXTDIRECTION_LTR<<0) | \
|
||||
(IBMBIDI_TEXTTYPE_CHARSET<<4) | \
|
||||
(IBMBIDI_CONTROLSTEXTMODE_LOGICAL<<8) | \
|
||||
(IBMBIDI_CLIPBOARDTEXTMODE_SOURCE<<12) | \
|
||||
(IBMBIDI_NUMERAL_NOMINAL<<16) | \
|
||||
(IBMBIDI_SUPPORTMODE_MOZILLA<<20) | \
|
||||
(IBMBIDI_CHARSET_BIDI<<24))
|
||||
(IBMBIDI_NUMERAL_NOMINAL<<12) | \
|
||||
(IBMBIDI_SUPPORTMODE_MOZILLA<<16) | \
|
||||
(IBMBIDI_CHARSET_BIDI<<20))
|
||||
|
||||
|
||||
#define GET_BIDI_OPTION_DIRECTION(bo) (((bo)>>0) & 0x0000000F) /* 4 bits for DIRECTION */
|
||||
#define GET_BIDI_OPTION_TEXTTYPE(bo) (((bo)>>4) & 0x0000000F) /* 4 bits for TEXTTYPE */
|
||||
#define GET_BIDI_OPTION_CONTROLSTEXTMODE(bo) (((bo)>>8) & 0x0000000F) /* 4 bits for CONTROLTEXTMODE */
|
||||
#define GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bo) (((bo)>>12) & 0x0000000F) /* 4 bits for CLIPBOARDTEXTMODE */
|
||||
#define GET_BIDI_OPTION_NUMERAL(bo) (((bo)>>16) & 0x0000000F) /* 4 bits for NUMERAL */
|
||||
#define GET_BIDI_OPTION_SUPPORT(bo) (((bo)>>20) & 0x0000000F) /* 4 bits for SUPPORT */
|
||||
#define GET_BIDI_OPTION_CHARACTERSET(bo) (((bo)>>24) & 0x0000000F) /* 4 bits for CHARACTERSET */
|
||||
#define GET_BIDI_OPTION_NUMERAL(bo) (((bo)>>12) & 0x0000000F) /* 4 bits for NUMERAL */
|
||||
#define GET_BIDI_OPTION_SUPPORT(bo) (((bo)>>16) & 0x0000000F) /* 4 bits for SUPPORT */
|
||||
#define GET_BIDI_OPTION_CHARACTERSET(bo) (((bo)>>20) & 0x0000000F) /* 4 bits for CHARACTERSET */
|
||||
|
||||
#define SET_BIDI_OPTION_DIRECTION(bo, dir) {(bo)=((bo) & 0xFFFFFFF0)|(((dir)& 0x0000000F)<<0);}
|
||||
#define SET_BIDI_OPTION_TEXTTYPE(bo, tt) {(bo)=((bo) & 0xFFFFFF0F)|(((tt)& 0x0000000F)<<4);}
|
||||
#define SET_BIDI_OPTION_CONTROLSTEXTMODE(bo, cotm) {(bo)=((bo) & 0xFFFFF0FF)|(((cotm)& 0x0000000F)<<8);}
|
||||
#define SET_BIDI_OPTION_CLIPBOARDTEXTMODE(bo, cltm) {(bo)=((bo) & 0xFFFF0FFF)|(((cltm)& 0x0000000F)<<12);}
|
||||
#define SET_BIDI_OPTION_NUMERAL(bo, num) {(bo)=((bo) & 0xFFF0FFFF)|(((num)& 0x0000000F)<<16);}
|
||||
#define SET_BIDI_OPTION_SUPPORT(bo, sup) {(bo)=((bo) & 0xFF0FFFFF)|(((sup)& 0x0000000F)<<20);}
|
||||
#define SET_BIDI_OPTION_CHARACTERSET(bo, cs) {(bo)=((bo) & 0xF0FFFFFF)|(((cs)& 0x0000000F)<<24);}
|
||||
#define SET_BIDI_OPTION_NUMERAL(bo, num) {(bo)=((bo) & 0xFFFF0FFF)|(((num)& 0x0000000F)<<12);}
|
||||
#define SET_BIDI_OPTION_SUPPORT(bo, sup) {(bo)=((bo) & 0xFFF0FFFF)|(((sup)& 0x0000000F)<<16);}
|
||||
#define SET_BIDI_OPTION_CHARACTERSET(bo, cs) {(bo)=((bo) & 0xFF0FFFFF)|(((cs)& 0x0000000F)<<20);}
|
||||
|
||||
/* Constants related to the position of numerics in the codepage */
|
||||
#define START_HINDI_DIGITS 0x0660
|
||||
|
@ -2567,27 +2567,6 @@ NS_IMETHODIMP DocumentViewerImpl::GetBidiControlsTextMode(PRUint8* aControlsText
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DocumentViewerImpl::SetBidiClipboardTextMode(PRUint8 aClipboardTextMode)
|
||||
{
|
||||
PRUint32 bidiOptions;
|
||||
|
||||
GetBidiOptions(&bidiOptions);
|
||||
SET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions, aClipboardTextMode);
|
||||
SetBidiOptions(bidiOptions);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DocumentViewerImpl::GetBidiClipboardTextMode(PRUint8* aClipboardTextMode)
|
||||
{
|
||||
PRUint32 bidiOptions;
|
||||
|
||||
if (aClipboardTextMode) {
|
||||
GetBidiOptions(&bidiOptions);
|
||||
*aClipboardTextMode = GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DocumentViewerImpl::SetBidiNumeral(PRUint8 aNumeral)
|
||||
{
|
||||
PRUint32 bidiOptions;
|
||||
|
@ -544,11 +544,6 @@ nsPresContext::GetUserPreferences()
|
||||
GET_BIDI_OPTION_CONTROLSTEXTMODE(mBidi));
|
||||
SET_BIDI_OPTION_CONTROLSTEXTMODE(mBidi, prefInt);
|
||||
|
||||
prefInt =
|
||||
nsContentUtils::GetIntPref("bidi.clipboardtextmode",
|
||||
GET_BIDI_OPTION_CLIPBOARDTEXTMODE(mBidi));
|
||||
SET_BIDI_OPTION_CLIPBOARDTEXTMODE(mBidi, prefInt);
|
||||
|
||||
prefInt =
|
||||
nsContentUtils::GetIntPref("bidi.numeral",
|
||||
GET_BIDI_OPTION_NUMERAL(mBidi));
|
||||
@ -1030,25 +1025,6 @@ nsPresContext::GetContainer()
|
||||
}
|
||||
|
||||
#ifdef IBMBIDI
|
||||
//ahmed
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::IsArabicEncoding(PRBool& aResult) const
|
||||
{
|
||||
aResult=PR_FALSE;
|
||||
if ( (mCharset.EqualsIgnoreCase("ibm864") )||(mCharset.EqualsIgnoreCase("ibm864i") )||(mCharset.EqualsIgnoreCase("windows-1256") )||(mCharset.EqualsIgnoreCase("iso-8859-6") ))
|
||||
aResult=PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::IsVisRTL(PRBool& aResult) const
|
||||
{
|
||||
aResult=PR_FALSE;
|
||||
if ( (mIsVisual)&&(GET_BIDI_OPTION_DIRECTION(mBidi) == IBMBIDI_TEXTDIRECTION_RTL) )
|
||||
aResult=PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsPresContext::BidiEnabled() const
|
||||
{
|
||||
@ -1122,16 +1098,6 @@ nsPresContext::GetBidi(PRUint32* aDest) const
|
||||
*aDest = mBidi;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//Mohamed 17-1-01
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::GetBidiCharset(nsACString &aCharSet) const
|
||||
{
|
||||
aCharSet = mCharset;
|
||||
return NS_OK;
|
||||
}
|
||||
//Mohamed End
|
||||
|
||||
#endif //IBMBIDI
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -456,19 +456,6 @@ public:
|
||||
* Get the Bidi options for the presentation context
|
||||
*/
|
||||
NS_IMETHOD GetBidi(PRUint32* aBidiOptions) const = 0;
|
||||
//ahmed
|
||||
|
||||
/**
|
||||
* Check for Bidi text mode and direction
|
||||
* @return aResult == TRUE if the text mode is visual and the direction is right-to-left
|
||||
*/
|
||||
NS_IMETHOD IsVisRTL(PRBool &aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Check for Arabic encoding
|
||||
* @return aResult == TRUE if the document encoding is an Arabic codepage
|
||||
*/
|
||||
NS_IMETHOD IsArabicEncoding(PRBool &aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Set the Bidi capabilities of the system
|
||||
@ -485,13 +472,6 @@ public:
|
||||
* @return TRUE if the system has the capability of reordering Bidi text
|
||||
*/
|
||||
PRBool IsBidiSystem() const { return mIsBidiSystem; }
|
||||
|
||||
/**
|
||||
* Get the document charset
|
||||
*/
|
||||
NS_IMETHOD GetBidiCharset(nsACString &aCharSet) const = 0;
|
||||
|
||||
|
||||
#endif // IBMBIDI
|
||||
|
||||
/**
|
||||
|
@ -456,19 +456,6 @@ public:
|
||||
* Get the Bidi options for the presentation context
|
||||
*/
|
||||
NS_IMETHOD GetBidi(PRUint32* aBidiOptions) const = 0;
|
||||
//ahmed
|
||||
|
||||
/**
|
||||
* Check for Bidi text mode and direction
|
||||
* @return aResult == TRUE if the text mode is visual and the direction is right-to-left
|
||||
*/
|
||||
NS_IMETHOD IsVisRTL(PRBool &aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Check for Arabic encoding
|
||||
* @return aResult == TRUE if the document encoding is an Arabic codepage
|
||||
*/
|
||||
NS_IMETHOD IsArabicEncoding(PRBool &aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Set the Bidi capabilities of the system
|
||||
@ -485,13 +472,6 @@ public:
|
||||
* @return TRUE if the system has the capability of reordering Bidi text
|
||||
*/
|
||||
PRBool IsBidiSystem() const { return mIsBidiSystem; }
|
||||
|
||||
/**
|
||||
* Get the document charset
|
||||
*/
|
||||
NS_IMETHOD GetBidiCharset(nsACString &aCharSet) const = 0;
|
||||
|
||||
|
||||
#endif // IBMBIDI
|
||||
|
||||
/**
|
||||
|
@ -456,19 +456,6 @@ public:
|
||||
* Get the Bidi options for the presentation context
|
||||
*/
|
||||
NS_IMETHOD GetBidi(PRUint32* aBidiOptions) const = 0;
|
||||
//ahmed
|
||||
|
||||
/**
|
||||
* Check for Bidi text mode and direction
|
||||
* @return aResult == TRUE if the text mode is visual and the direction is right-to-left
|
||||
*/
|
||||
NS_IMETHOD IsVisRTL(PRBool &aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Check for Arabic encoding
|
||||
* @return aResult == TRUE if the document encoding is an Arabic codepage
|
||||
*/
|
||||
NS_IMETHOD IsArabicEncoding(PRBool &aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Set the Bidi capabilities of the system
|
||||
@ -485,13 +472,6 @@ public:
|
||||
* @return TRUE if the system has the capability of reordering Bidi text
|
||||
*/
|
||||
PRBool IsBidiSystem() const { return mIsBidiSystem; }
|
||||
|
||||
/**
|
||||
* Get the document charset
|
||||
*/
|
||||
NS_IMETHOD GetBidiCharset(nsACString &aCharSet) const = 0;
|
||||
|
||||
|
||||
#endif // IBMBIDI
|
||||
|
||||
/**
|
||||
|
@ -138,58 +138,6 @@ nsresult nsCopySupport::HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef IBMBIDI //ahmed
|
||||
rv = NS_OK;
|
||||
PRBool arabicCharset;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
|
||||
if (doc) {
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context) );
|
||||
if (context) {
|
||||
context->IsArabicEncoding(arabicCharset);
|
||||
if (arabicCharset) {
|
||||
PRUint32 bidiOptions;
|
||||
PRBool isBidiSystem = context->IsBidiSystem();
|
||||
PRBool isVisual = context->IsVisualMode();
|
||||
|
||||
context->GetBidi(&bidiOptions);
|
||||
if ( (GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions) == IBMBIDI_CLIPBOARDTEXTMODE_LOGICAL)&&(isVisual)
|
||||
) {
|
||||
nsAutoString newBuffer;
|
||||
if (isBidiSystem) {
|
||||
if (GET_BIDI_OPTION_DIRECTION(bidiOptions) == IBMBIDI_TEXTDIRECTION_RTL) {
|
||||
Conv_FE_06(buffer, newBuffer);
|
||||
}
|
||||
else {
|
||||
Conv_FE_06_WithReverse(buffer, newBuffer);
|
||||
}
|
||||
}
|
||||
else { //nonbidisystem
|
||||
HandleNumbers(buffer, newBuffer);//ahmed
|
||||
}
|
||||
buffer = newBuffer;
|
||||
}
|
||||
//Mohamed
|
||||
else {
|
||||
nsCAutoString bidiCharset;
|
||||
context->GetBidiCharset(bidiCharset);
|
||||
if (bidiCharset.EqualsIgnoreCase("UTF-8") || (!isVisual)) {
|
||||
if ( (GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions) == IBMBIDI_CLIPBOARDTEXTMODE_VISUAL) || (!isBidiSystem) ) {
|
||||
nsAutoString newBuffer;
|
||||
Conv_06_FE_WithReverse(buffer, newBuffer, GET_BIDI_OPTION_DIRECTION(bidiOptions));
|
||||
HandleNumbers(newBuffer, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // IBMBIDI
|
||||
|
||||
// Get the Clipboard
|
||||
nsCOMPtr<nsIClipboard> clipboard(do_GetService(kCClipboardCID, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -544,11 +544,6 @@ nsPresContext::GetUserPreferences()
|
||||
GET_BIDI_OPTION_CONTROLSTEXTMODE(mBidi));
|
||||
SET_BIDI_OPTION_CONTROLSTEXTMODE(mBidi, prefInt);
|
||||
|
||||
prefInt =
|
||||
nsContentUtils::GetIntPref("bidi.clipboardtextmode",
|
||||
GET_BIDI_OPTION_CLIPBOARDTEXTMODE(mBidi));
|
||||
SET_BIDI_OPTION_CLIPBOARDTEXTMODE(mBidi, prefInt);
|
||||
|
||||
prefInt =
|
||||
nsContentUtils::GetIntPref("bidi.numeral",
|
||||
GET_BIDI_OPTION_NUMERAL(mBidi));
|
||||
@ -1030,25 +1025,6 @@ nsPresContext::GetContainer()
|
||||
}
|
||||
|
||||
#ifdef IBMBIDI
|
||||
//ahmed
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::IsArabicEncoding(PRBool& aResult) const
|
||||
{
|
||||
aResult=PR_FALSE;
|
||||
if ( (mCharset.EqualsIgnoreCase("ibm864") )||(mCharset.EqualsIgnoreCase("ibm864i") )||(mCharset.EqualsIgnoreCase("windows-1256") )||(mCharset.EqualsIgnoreCase("iso-8859-6") ))
|
||||
aResult=PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::IsVisRTL(PRBool& aResult) const
|
||||
{
|
||||
aResult=PR_FALSE;
|
||||
if ( (mIsVisual)&&(GET_BIDI_OPTION_DIRECTION(mBidi) == IBMBIDI_TEXTDIRECTION_RTL) )
|
||||
aResult=PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsPresContext::BidiEnabled() const
|
||||
{
|
||||
@ -1122,16 +1098,6 @@ nsPresContext::GetBidi(PRUint32* aDest) const
|
||||
*aDest = mBidi;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//Mohamed 17-1-01
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::GetBidiCharset(nsACString &aCharSet) const
|
||||
{
|
||||
aCharSet = mCharset;
|
||||
return NS_OK;
|
||||
}
|
||||
//Mohamed End
|
||||
|
||||
#endif //IBMBIDI
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -103,13 +103,6 @@ public:
|
||||
NS_IMETHOD GetBidiUtils(nsBidiPresUtils** aBidiUtils);
|
||||
NS_IMETHOD SetBidi(PRUint32 aSource, PRBool aForceReflow = PR_FALSE);
|
||||
NS_IMETHOD GetBidi(PRUint32* aDest) const;
|
||||
//ahmed
|
||||
NS_IMETHOD IsVisRTL(PRBool &aResult) const;
|
||||
NS_IMETHOD IsArabicEncoding(PRBool &aResult) const;
|
||||
|
||||
//Mohamed 17-1-01
|
||||
NS_IMETHOD GetBidiCharset(nsACString &aCharSet) const;
|
||||
//Mohamed End
|
||||
#endif // IBMBIDI
|
||||
|
||||
NS_IMETHOD GetTheme(nsITheme** aResult);
|
||||
|
@ -737,13 +737,6 @@ pref("bidi.texttype", 1);
|
||||
// 3 = containercontrolstextmodeBidi *
|
||||
pref("bidi.controlstextmode", 1);
|
||||
// ------------------
|
||||
// Clipboard Text Mode
|
||||
// ------------------
|
||||
// 1 = logicalclipboardtextmodeBidi
|
||||
// 2 = visiualclipboardtextmodeBidi
|
||||
// 3 = sourceclipboardtextmodeBidi *
|
||||
pref("bidi.clipboardtextmode", 3);
|
||||
// ------------------
|
||||
// Numeral Style
|
||||
// ------------------
|
||||
// 0 = nominalnumeralBidi *
|
||||
|
@ -95,10 +95,6 @@
|
||||
<!ENTITY logicalcontrolstextmodeBidiCmd.label "Logical">
|
||||
<!ENTITY visiualcontrolstextmodeBidiCmd.label "Visual">
|
||||
<!ENTITY containercontrolstextmodeBidiCmd.label "Like Containing Document">
|
||||
<!ENTITY clipboardtextmodeBidiMenu.label "Text Mode in clipboard">
|
||||
<!ENTITY logicalclipboardtextmodeBidiCmd.label "Logical">
|
||||
<!ENTITY visiualclipboardtextmodeBidiCmd.label "Visual">
|
||||
<!ENTITY sourceclipboardtextmodeBidiCmd.label "As Source">
|
||||
<!ENTITY charactersetBidiMenu.label "Character set">
|
||||
<!ENTITY doccharactersetBidiCmd.label "Use the document specified character set">
|
||||
<!ENTITY defaultcharactersetBidiCmd.label "Use my default character set, overriding the document-specified character set">
|
||||
|
@ -31,13 +31,6 @@
|
||||
<!ENTITY visualcontrolstextmode.accesskey "s">
|
||||
<!ENTITY containercontrolstextmode.label "Like Containing Document">
|
||||
<!ENTITY containercontrolstextmode.accesskey "d">
|
||||
<!ENTITY clipboardtextmode.label "Text Mode in clipboard">
|
||||
<!ENTITY logicalclipboardtextmode.label "Logical">
|
||||
<!ENTITY logicalclipboardtextmode.accesskey "b">
|
||||
<!ENTITY visualclipboardtextmode.label "Visual">
|
||||
<!ENTITY visualclipboardtextmode.accesskey "v">
|
||||
<!ENTITY sourceclipboardtextmode.label "As Source">
|
||||
<!ENTITY sourceclipboardtextmode.accesskey "z">
|
||||
<!ENTITY characterset.label "Character set">
|
||||
<!ENTITY doccharacterset.label "Use the document specified character set">
|
||||
<!ENTITY doccharacterset.accesskey "n">
|
||||
|
Loading…
Reference in New Issue
Block a user