diff options
author | Lei De Bin <leidb@apache.org> | 2012-09-12 04:07:30 +0000 |
---|---|---|
committer | Lei De Bin <leidb@apache.org> | 2012-09-12 04:07:30 +0000 |
commit | daa4da26a7ba0c58c79af69fc6624729f7b22c10 (patch) | |
tree | 051c7a2221652c622d44c2cf060fab9a3ca41092 /sw | |
parent | 1619e67c0c225ca6cc14a1fbebd4a97fb1b26311 (diff) |
#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
Notes
Notes:
merged as: 5faf5492741abfd013ae677b1ec2fc06276d8644
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/doc.hxx | 7 | ||||
-rw-r--r-- | sw/inc/hintids.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/text/atrstck.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/attributeoutputbase.hxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.hxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 31 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8attributeoutput.hxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 35 |
12 files changed, 95 insertions, 12 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index bc1204a9849d..fdcdb880b540 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -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 */ diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 955e37cb736a..1f5ca4950a58 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -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 }; diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 343bca887f60..61e9f82432cc 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -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 ); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 740299b848aa..e4f223d4e3a8 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -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 ), diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index 5f0d7ebcdf31..9661e97bda6a 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -121,6 +121,8 @@ const sal_uInt8 StackPos[ static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) - 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 diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 600245496b26..4425df55dec7 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -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; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index b5dfa61d4d4b..f7c7ccd5a4ba 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2130,6 +2130,13 @@ void RtfAttributeOutput::CharWeightCTL( const SvxWeightItem& rWeight ) 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) { diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index f5f8d4efe27c..32eabd1509dc 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -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 ); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 66ef5ba57a21..cffbaaf78a1f 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -949,8 +949,11 @@ void WW8AttributeOutput::RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript ) { 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( const SvxCharReliefItem& rRelief ) } } +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( const SfxPoolItem& rHt ) 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; diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index e1e8cea1ec96..df8767276c0a 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -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& ); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index e08ff5b93af8..ce212b468999 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3897,6 +3897,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) { sal_uLong nErrRet = 0; + rDoc.SetDocumentType( SwDoc::DOCTYPE_MSWORD ); if (mbNewDoc && pStg && !pGloss) ReadDocInfo(); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 2028a9057968..953293b896af 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2991,12 +2991,19 @@ void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const sal_uInt8* pData, shor 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_uInt16 nId, const sal_uInt8* pData, short nLe 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 ) |