Kaydet (Commit) daa4da26 authored tarafından Lei De Bin's avatar Lei De Bin

#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 
üst 1619e67c
......@@ -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
*/
......
......@@ -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
};
......
......@@ -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 );
......
......@@ -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 ),
......
......@@ -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
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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& );
......
......@@ -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();
......
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment