Index: sw/inc/doc.hxx =================================================================== --- sw/inc/doc.hxx (revision 1381841) +++ sw/inc/doc.hxx (working copy) @@ -712,6 +712,13 @@ 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 */ Index: sw/inc/hintids.hxx =================================================================== --- sw/inc/hintids.hxx (revision 1381841) +++ sw/inc/hintids.hxx (working copy) @@ -93,6 +93,8 @@ RES_CHRATR_OVERLINE, // 38 RES_CHRATR_DUMMY1, // 39 RES_CHRATR_DUMMY2, // 40 + RES_CHRATR_BIDIRTL, + RES_CHRATR_IDCTHINT, RES_CHRATR_END }; Index: sw/source/core/bastyp/init.cxx =================================================================== --- sw/source/core/bastyp/init.cxx (revision 1381841) +++ sw/source/core/bastyp/init.cxx (working copy) @@ -303,6 +303,8 @@ { 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 @@ 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 ); Index: sw/source/core/doc/docnew.cxx =================================================================== --- sw/source/core/doc/docnew.cxx (revision 1381841) +++ sw/source/core/doc/docnew.cxx (working copy) @@ -288,6 +288,7 @@ mIdleBlockCount(0), nLockExpFld( 0 ), mbReadlineChecked(false), + meDocType( DOCTYPE_NATIVE ), // --> OD 2005-02-11 #i38810# mbLinksUpdated( sal_False ), mbClipBoard( false ), Index: sw/source/core/text/atrstck.cxx =================================================================== --- sw/source/core/text/atrstck.cxx (revision 1381841) +++ sw/source/core/text/atrstck.cxx (working copy) @@ -121,6 +121,8 @@ 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 Index: sw/source/filter/ww8/attributeoutputbase.hxx =================================================================== --- sw/source/filter/ww8/attributeoutputbase.hxx (revision 1381841) +++ sw/source/filter/ww8/attributeoutputbase.hxx (working copy) @@ -405,6 +405,11 @@ /// 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; Index: sw/source/filter/ww8/rtfattributeoutput.cxx =================================================================== --- sw/source/filter/ww8/rtfattributeoutput.cxx (revision 1381841) +++ sw/source/filter/ww8/rtfattributeoutput.cxx (working copy) @@ -2130,7 +2130,14 @@ 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) { OSL_TRACE("%s", OSL_THIS_FUNC); Index: sw/source/filter/ww8/rtfattributeoutput.hxx =================================================================== --- sw/source/filter/ww8/rtfattributeoutput.hxx (revision 1381841) +++ sw/source/filter/ww8/rtfattributeoutput.hxx (working copy) @@ -308,6 +308,12 @@ /// 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 ); Index: sw/source/filter/ww8/ww8atr.cxx =================================================================== --- sw/source/filter/ww8/ww8atr.cxx (revision 1381841) +++ sw/source/filter/ww8/ww8atr.cxx (working copy) @@ -949,8 +949,11 @@ { 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::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 @@ 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; Index: sw/source/filter/ww8/ww8attributeoutput.hxx =================================================================== --- sw/source/filter/ww8/ww8attributeoutput.hxx (revision 1381841) +++ sw/source/filter/ww8/ww8attributeoutput.hxx (working copy) @@ -290,6 +290,12 @@ /// 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& ); Index: sw/source/filter/ww8/ww8par.cxx =================================================================== --- sw/source/filter/ww8/ww8par.cxx (revision 1381841) +++ sw/source/filter/ww8/ww8par.cxx (working copy) @@ -3897,6 +3897,7 @@ { sal_uLong nErrRet = 0; + rDoc.SetDocumentType( SwDoc::DOCTYPE_MSWORD ); if (mbNewDoc && pStg && !pGloss) ReadDocInfo(); Index: sw/source/filter/ww8/ww8par6.cxx =================================================================== --- sw/source/filter/ww8/ww8par6.cxx (revision 1381841) +++ sw/source/filter/ww8/ww8par6.cxx (working copy) @@ -2991,12 +2991,19 @@ 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_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 )