You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by le...@apache.org on 2012/09/12 07:07:31 UTC

svn commit: r1383777 - in /incubator/ooo/trunk/main/sw: inc/ source/core/bastyp/ source/core/doc/ source/core/text/ source/filter/ww8/

Author: leidb
Date: Wed Sep 12 05:07:30 2012
New Revision: 1383777

URL: http://svn.apache.org/viewvc?rev=1383777&view=rev
Log:
#119612# fix the order of Hebraic string are changed after save as new .doc
 * when opening .doc in AOO, preserve the RTL property(property ID is 0x085A) and export. 
Reported by: Lou Qing le
Patch by: Chen Zuo Jun
Review by: Lei De Bin 

Modified:
    incubator/ooo/trunk/main/sw/inc/doc.hxx
    incubator/ooo/trunk/main/sw/inc/hintids.hxx
    incubator/ooo/trunk/main/sw/source/core/bastyp/init.cxx
    incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx
    incubator/ooo/trunk/main/sw/source/core/text/atrstck.cxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/attributeoutputbase.hxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8attributeoutput.hxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx

Modified: incubator/ooo/trunk/main/sw/inc/doc.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/inc/doc.hxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/inc/doc.hxx (original)
+++ incubator/ooo/trunk/main/sw/inc/doc.hxx Wed Sep 12 05:07:30 2012
@@ -712,6 +712,13 @@ private:
      bool ReplaceRangeImpl(SwPaM&, String const&, const bool);
 
 public:
+	enum DocumentType {
+		DOCTYPE_NATIVE,
+		DOCTYPE_MSWORD				//This doc medul is come from Ms Word
+		};
+	DocumentType	meDocType;
+	DocumentType	GetDocumentType(){ return meDocType; }
+	void			SetDocumentType( DocumentType eDocType ) { meDocType = eDocType; }
 
     /** Life cycle
     */

Modified: incubator/ooo/trunk/main/sw/inc/hintids.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/inc/hintids.hxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/inc/hintids.hxx (original)
+++ incubator/ooo/trunk/main/sw/inc/hintids.hxx Wed Sep 12 05:07:30 2012
@@ -93,6 +93,8 @@ RES_CHRATR_BEGIN = HINT_BEGIN,
 	RES_CHRATR_OVERLINE,					// 38
 	RES_CHRATR_DUMMY1,						// 39
 	RES_CHRATR_DUMMY2,						// 40
+	RES_CHRATR_BIDIRTL,						
+	RES_CHRATR_IDCTHINT,					
 RES_CHRATR_END
 };
 

Modified: incubator/ooo/trunk/main/sw/source/core/bastyp/init.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/bastyp/init.cxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/bastyp/init.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/bastyp/init.cxx Wed Sep 12 05:07:30 2012
@@ -303,6 +303,8 @@ SfxItemInfo __FAR_DATA aSlotTab[] =
 	{ SID_ATTR_CHAR_OVERLINE, SFX_ITEM_POOLABLE },  	// RES_CHRATR_OVERLINE
 	{ 0, SFX_ITEM_POOLABLE },							// RES_CHRATR_DUMMY1
 	{ 0, SFX_ITEM_POOLABLE },							// RES_CHRATR_DUMMY2
+	{ 0, SFX_ITEM_POOLABLE },							// RES_CHRATR_BIDIRTL
+	{ 0, SFX_ITEM_POOLABLE },							// RES_CHRATR_IDCTHINT
 
     { 0, 0 },                                           // RES_TXTATR_REFMARK
     { 0, 0 },                                           // RES_TXTATR_TOXMARK
@@ -543,6 +545,8 @@ void _InitCore()
 	aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 );
     aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 );
 // TextAttr - Dummies
+	aAttrTab[ RES_CHRATR_BIDIRTL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_CHRATR_BIDIRTL, sal_Int16(-1) );
+	aAttrTab[ RES_CHRATR_IDCTHINT - POOLATTR_BEGIN ] = new SfxInt16Item( RES_CHRATR_IDCTHINT, sal_Int16(-1) );
 
     aAttrTab[ RES_PARATR_LINESPACING- POOLATTR_BEGIN ] = new SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
     aAttrTab[ RES_PARATR_ADJUST- POOLATTR_BEGIN ] = new SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST );

Modified: incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx Wed Sep 12 05:07:30 2012
@@ -288,6 +288,7 @@ SwDoc::SwDoc()
     mIdleBlockCount(0),
     nLockExpFld( 0 ),
 	mbReadlineChecked(false),
+	meDocType( DOCTYPE_NATIVE ),
     // --> OD 2005-02-11 #i38810#
     mbLinksUpdated( sal_False ),
     mbClipBoard( false ),

Modified: incubator/ooo/trunk/main/sw/source/core/text/atrstck.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/text/atrstck.cxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/text/atrstck.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/text/atrstck.cxx Wed Sep 12 05:07:30 2012
@@ -121,6 +121,8 @@ const sal_uInt8 StackPos[ static_cast<sa
     35, // RES_CHRATR_OVERLINE,                  // 38
      0, // RES_CHRATR_DUMMY1,                    // 39
      0, // RES_CHRATR_DUMMY2,                    // 40
+	 0, // RES_CHRATR_BIDIRTL
+	 0, // RES_CHRATR_IDCTHINT
     36, // RES_TXTATR_REFMARK,                   // 41
     37, // RES_TXTATR_TOXMARK,                   // 42
     38, // RES_TXTATR_META,                      // 43

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/attributeoutputbase.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/attributeoutputbase.hxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/attributeoutputbase.hxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/attributeoutputbase.hxx Wed Sep 12 05:07:30 2012
@@ -405,6 +405,11 @@ protected:
     /// Sfx item RES_CHRATR_CTL_WEIGHT
     virtual void CharWeightCTL( const SvxWeightItem& ) = 0;
 
+	/// Sfx item RES_CHRATR_BidiRTL
+    virtual void CharBidiRTL( const SfxPoolItem& ) = 0;
+
+    /// Sfx item RES_CHRATR_IdctHint
+    virtual void CharIdctHint( const SfxPoolItem& ) = 0;
     /// Sfx item RES_CHRATR_ROTATE
     virtual void CharRotate( const SvxCharRotateItem& ) = 0;
 

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx Wed Sep 12 05:07:30 2012
@@ -2130,6 +2130,13 @@ void RtfAttributeOutput::CharWeightCTL( 
     if ( rWeight.GetWeight() != WEIGHT_BOLD )
         m_aStyles.append((sal_Int32)0);
 }
+void RtfAttributeOutput:: CharBidiRTL( const SfxPoolItem& )
+{
+}
+
+void RtfAttributeOutput:: CharIdctHint( const SfxPoolItem&)
+{
+}
 
 void RtfAttributeOutput::CharRotate( const SvxCharRotateItem& rRotate)
 {

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx Wed Sep 12 05:07:30 2012
@@ -308,6 +308,12 @@ protected:
     /// Sfx item RES_CHRATR_CTL_WEIGHT
     virtual void CharWeightCTL( const SvxWeightItem& rWeight );
 
+    /// Sfx item RES_CHRATR_BidiRTL
+    virtual void CharBidiRTL( const SfxPoolItem& );
+
+    /// Sfx item RES_CHRATR_IdctHint
+    virtual void CharIdctHint( const SfxPoolItem& );
+
     /// Sfx item RES_CHRATR_ROTATE
     virtual void CharRotate( const SvxCharRotateItem& rRotate );
 

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx Wed Sep 12 05:07:30 2012
@@ -949,8 +949,11 @@ void WW8AttributeOutput::RTLAndCJKState(
 {
     if ( m_rWW8Export.bWrtWW8 && bIsRTL )
     {
-        m_rWW8Export.InsUInt16( NS_sprm::LN_CFBiDi );
-        m_rWW8Export.pO->Insert( (sal_uInt8)1, m_rWW8Export.pO->Count() );
+        if( m_rWW8Export.pDoc->GetDocumentType() != SwDoc::DOCTYPE_MSWORD )
+        {
+        	m_rWW8Export.InsUInt16( NS_sprm::LN_CFBiDi );
+        	m_rWW8Export.pO->Insert( (sal_uInt8)1, m_rWW8Export.pO->Count() );
+        }
     }
 
     // #i46087# patch from james_clark; complex texts needs the undocumented SPRM CComplexScript with param 0x81.
@@ -1496,6 +1499,23 @@ void WW8AttributeOutput::CharRelief( con
     }
 }
 
+void WW8AttributeOutput::CharBidiRTL( const SfxPoolItem& rHt )
+{
+	const SfxInt16Item& rAttr = (const SfxInt16Item&)rHt;
+	if( rAttr.GetValue() == 1 )
+	{
+		m_rWW8Export.InsUInt16(0x85a);
+		m_rWW8Export.pO->Insert((sal_uInt8)1, m_rWW8Export.pO->Count());			
+	}
+}
+
+void WW8AttributeOutput::CharIdctHint( const SfxPoolItem& rHt )
+{
+	const SfxInt16Item& rAttr = (const SfxInt16Item&)rHt;
+	m_rWW8Export.InsUInt16(0x286F);
+	m_rWW8Export.pO->Insert((sal_uInt8)(rAttr.GetValue()), m_rWW8Export.pO->Count());			
+}
+
 void WW8AttributeOutput::CharRotate( const SvxCharRotateItem& rRotate )
 {
     // #i28331# - check that a Value is set
@@ -5186,7 +5206,12 @@ void AttributeOutputBase::OutputItem( co
         case RES_CHRATR_HIDDEN:
             CharHidden( static_cast< const SvxCharHiddenItem& >( rHt ) );
             break;
-
+        case RES_CHRATR_BIDIRTL:
+			CharBidiRTL( static_cast< const SfxPoolItem& >( rHt ) );
+			break;
+        case RES_CHRATR_IDCTHINT:
+			CharIdctHint( static_cast< const SfxPoolItem& >( rHt ) );
+			break;
         case RES_TXTATR_INETFMT:
             TextINetFormat( static_cast< const SwFmtINetFmt& >( rHt ) );
             break;

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8attributeoutput.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8attributeoutput.hxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8attributeoutput.hxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8attributeoutput.hxx Wed Sep 12 05:07:30 2012
@@ -290,6 +290,12 @@ protected:
     /// Sfx item RES_CHRATR_CTL_WEIGHT
     virtual void CharWeightCTL( const SvxWeightItem& );
 
+    /// Sfx item RES_CHRATR_BidiRTL
+    virtual void CharBidiRTL( const SfxPoolItem& rHt );
+
+    /// Sfx item RES_CHRATR_IdctHint
+    virtual void CharIdctHint( const SfxPoolItem& rHt );
+
     /// Sfx item RES_CHRATR_ROTATE
     virtual void CharRotate( const SvxCharRotateItem& );
 

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx Wed Sep 12 05:07:30 2012
@@ -3897,6 +3897,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8G
 {
     sal_uLong nErrRet = 0;
 
+	rDoc.SetDocumentType( SwDoc::DOCTYPE_MSWORD );
     if (mbNewDoc && pStg && !pGloss)
         ReadDocInfo();
 

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx?rev=1383777&r1=1383776&r2=1383777&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx Wed Sep 12 05:07:30 2012
@@ -2991,12 +2991,19 @@ void SwWW8ImplReader::Read_BoldUsw( sal_
     SetToggleAttr( nI, bOn );
 }
 
-void SwWW8ImplReader::Read_Bidi(sal_uInt16, const sal_uInt8*, short nLen)
+void SwWW8ImplReader::Read_Bidi(sal_uInt16, const sal_uInt8* pData, short nLen)
 {
-	if (nLen > 0)
-		bBidi = true;
-	else
-		bBidi = false;
+	if( nLen < 0 )	//Property end
+	{
+		bBidi = sal_False;
+		pCtrlStck->SetAttr(*pPaM->GetPoint(),RES_CHRATR_BIDIRTL);
+	}
+	else	//Property start
+	{
+		bBidi = sal_True;
+		sal_uInt8 nBidi = SVBT8ToByte( pData );
+		NewAttr( SfxInt16Item( RES_CHRATR_BIDIRTL, (nBidi!=0)? 1 : 0 ) );	
+	}
 }
 
 // Read_BoldUsw for BiDi Italic, Bold
@@ -4353,10 +4360,20 @@ void SwWW8ImplReader::Read_UL( sal_uInt1
 
 void SwWW8ImplReader::Read_IdctHint( sal_uInt16, const sal_uInt8* pData, short nLen )
 {
-    if (nLen < 0)
-        nIdctHint = 0;
-    else
-        nIdctHint = *pData;
+    // sprmcidcthint (opcode 0x286f) specifies a script bias for the text in the run. 
+    // for unicode characters that are shared between far east and non-far east scripts, 
+    // this property determines what font and language the character will use. 
+    // when this value is 0, text properties bias towards non-far east properties. 
+    // when this value is 1, text properties bias towards far east properties. 
+	if( nLen < 0 )	//Property end 
+	{
+		pCtrlStck->SetAttr(*pPaM->GetPoint(),RES_CHRATR_IDCTHINT);
+	}
+	else	//Property start
+	{
+		sal_uInt8 nVal = SVBT8ToByte( pData );
+		NewAttr( SfxInt16Item( RES_CHRATR_IDCTHINT, (nVal!=0)? 1 : 0 ) );	
+	}
 }
 
 void SwWW8ImplReader::Read_Justify( sal_uInt16, const sal_uInt8* pData, short nLen )