--- old/editeng/source/editeng/impedit.hxx 2011-11-17 09:47:06.000000000 +0800 +++ old/editeng/source/editeng/impedit.hxx 2011-11-17 10:12:32.000000000 +0800 @@ -479,6 +479,9 @@ sal_Bool bFormatted; sal_Bool bInSelection; sal_Bool bIsInUndo; + //#115580# fixed by JingDongChen from China at 2011/11/16 start + sal_Bool bIsPasting; + //#115580# fixed by JingDongChen from China at 2011/11/16 end sal_Bool bUpdate; sal_Bool bUndoEnabled; sal_Bool bOwnerOfRefDev; @@ -543,6 +546,9 @@ void SetParaAttrib( sal_uInt8 nFunc, EditSelection aSel, sal_uInt16 nValue ); sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel ); void SetCharAttrib( EditSelection aSel, const SfxPoolItem& rItem ); + //#115580# fixed by JingDongChen from China at 2011/11/16 start + void AdjustParaAttribsByStyleSheet( ContentNode* pNode ); + //#115580# fixed by JingDongChen from China at 2011/11/16 end void ParaAttribsToCharAttribs( ContentNode* pNode ); void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const; --- old/editeng/source/editeng/impedit2.cxx 2011-11-17 09:46:44.000000000 +0800 +++ old/editeng/source/editeng/impedit2.cxx 2011-11-17 10:12:32.000000000 +0800 @@ -133,6 +133,9 @@ bOwnerOfRefDev = sal_False; bDowning = sal_False; bIsInUndo = sal_False; + //#115580# fixed by JingDongChen from China at 2011/11/16 start + bIsPasting = sal_False; + //#115580# fixed by JingDongChen from China at 2011/11/16 end bIsFormatting = sal_False; bFormatted = sal_False; bUpdate = sal_True; @@ -3701,6 +3704,9 @@ if ( rxDataObj.is() ) { + //#115580# fixed by JingDongChen from China at 2011/11/16 start + bIsPasting = sal_True; + //#115580# fixed by JingDongChen from China at 2011/11/16 end datatransfer::DataFlavor aFlavor; sal_Bool bDone = sal_False; @@ -3791,6 +3797,9 @@ } } } + //#115580# fixed by JingDongChen from China at 2011/11/16 start + bIsPasting = sal_False; + //#115580# fixed by JingDongChen from China at 2011/11/16 end } return aNewSelection; --- old/editeng/source/editeng/impedit4.cxx 2011-11-17 09:46:52.000000000 +0800 +++ old/editeng/source/editeng/impedit4.cxx 2011-11-17 10:12:32.000000000 +0800 @@ -1240,7 +1240,15 @@ // Kein GetPos undFindParaportion, sondern Index berechnen! EditSelection aSel( aPaM, aPaM ); DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "InsertBibTextObject: Selektion kaput!(1)" ); - + + //#115580# fixed by JingDongChen from China at 2011/11/16 start + EditPaM aStart1PaM( aSel.Min().GetNode(), aSel.Min().GetIndex() ); + aSel = ImpInsertParaBreak( aSel ); + EditPaM aStart2PaM = aSel.Min(); + EditPaM aEnd1PaM( ImpInsertParaBreak( aSel.Max() ) ); + aEnd1PaM.GetNode()->SetStyleSheet( aStart1PaM.GetNode()->GetStyleSheet(), sal_False ); + //#115580# fixed by JingDongChen from China at 2011/11/16 end + sal_Bool bUsePortionInfo = sal_False; // sal_Bool bFields = sal_False; XParaPortionList* pPortionInfo = rTextObject.GetPortionInfo(); @@ -1270,6 +1278,19 @@ for ( sal_uInt16 n = 0; n < nContents; n++, nPara++ ) { ContentInfo* pC = rTextObject.GetContents().GetObject( n ); + + //#115580# fixed by JingDongChen from China at 2011/11/16 start + if ( bIsPasting ) + { + if ( !n ) + aPaM = aStart2PaM; + + aPaM.GetNode()->SetStyleSheet( aStart1PaM.GetNode()->GetStyleSheet(), sal_False ); + aPaM.GetNode()->GetContentAttribs().GetItems().ClearItem(); + aPaM.GetNode()->GetCharAttribs().Clear(); + } + //#115580# fixed by JingDongChen from China at 2011/11/16 end + sal_Bool bNewContent = aPaM.GetNode()->Len() ? sal_False: sal_True; sal_uInt16 nStartPos = aPaM.GetIndex(); @@ -1340,6 +1361,20 @@ // nur dann Style und ParaAttribs, wenn neuer Absatz, oder // komplett inneliegender... bParaAttribs = pC->GetParaAttribs().Count() ? sal_True : sal_False; + + //#115580# fixed by JingDongChen from China at 2011/11/16 start + if ( bIsPasting ) + { + nPara = aEditDoc.GetPos( aPaM.GetNode() ); + if ( GetStyleSheetPool() && pC->GetStyle().Len() ) + { + SfxStyleSheet* pStyle = (SfxStyleSheet*)GetStyleSheetPool()->Find( pC->GetStyle(), pC->GetFamily() ); + DBG_ASSERT( pStyle, "InsertBinTextObject - Style not found!" ); + SetStyleSheet( nPara, pStyle ); + } + } + else + //#115580# fixed by JingDongChen from China at 2011/11/16 end if ( GetStyleSheetPool() && pC->GetStyle().Len() ) { SfxStyleSheet* pStyle = (SfxStyleSheet*)GetStyleSheetPool()->Find( pC->GetStyle(), pC->GetFamily() ); @@ -1412,6 +1447,14 @@ } #endif // !SVX_LIGHT + //#115580# fixed by JingDongChen from China at 2011/11/16 start + if ( bIsPasting ) + { + AdjustParaAttribsByStyleSheet( aPaM.GetNode() ); + ParaAttribsToCharAttribs( aPaM.GetNode() ); + } + //#115580# fixed by JingDongChen from China at 2011/11/16 end + // Zeilenumbruch, wenn weitere folgen... if ( n < ( nContents-1) ) { @@ -1422,7 +1465,25 @@ } } - aSel.Max() = aPaM; + //#115580# fixed by JingDongChen from China at 2011/11/16 start + /* aSel.Max() = aPaM; */ + + if ( bIsPasting ) + { + EditPaM aEnd2PaM( aPaM ); + + sal_Bool bSpecialBackward = aStart1PaM.GetNode()->Len() ? sal_False : sal_True; + + aSel.Min() = ImpConnectParagraphs( aStart1PaM.GetNode(), aStart2PaM.GetNode(), bSpecialBackward ); + bSpecialBackward = aEnd1PaM.GetNode()->Len() ? sal_True : sal_False; + + aSel.Max() = ImpConnectParagraphs( ( ( nContents == 1 ) ? aStart1PaM.GetNode() : aEnd2PaM.GetNode() ), + aEnd1PaM.GetNode(), bSpecialBackward ); + } + else + aSel.Max() = aPaM; + //#115580# fixed by JingDongChen from China at 2011/11/16 end + DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "InsertBibTextObject: Selektion kaput!(1)" ); return aSel; } --- old/editeng/source/editeng/impedit5.cxx 2011-11-17 09:46:58.000000000 +0800 +++ old/editeng/source/editeng/impedit5.cxx 2011-11-17 10:12:32.000000000 +0800 @@ -813,6 +813,25 @@ } } +//#115580# fixed by JingDongChen from China at 2011/11/16 start +void ImpEditEngine::AdjustParaAttribsByStyleSheet( ContentNode* pNode ) +{ + if ( !pNode ) + return; + + SfxStyleSheet* pStyle = pNode->GetStyleSheet(); + for ( sal_uInt16 nWhich = EE_PARA_START; nWhich < EE_CHAR_START && pStyle; nWhich++ ) + { + if ( pNode->GetContentAttribs().HasItem( nWhich ) ) + { + const SfxItemSet& rStyleAttribs = pStyle->GetItemSet(); + if ( rStyleAttribs.GetItemState( nWhich ) == SFX_ITEM_ON ) + pNode->GetContentAttribs().GetItems().ClearItem( nWhich ); + } + } +} +//#115580# fixed by JingDongChen from China at 2011/11/16 end + void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* pNode ) { pNode->GetCharAttribs().DeleteEmptyAttribs( GetEditDoc().GetItemPool() ); @@ -841,6 +860,11 @@ } bFormatted = sal_False; // Portion braucht hier nicht invalidiert werden, geschieht woanders. + + //#115580# fixed by JingDongChen from China at 2011/11/16 start + if ( bIsPasting ) + pNode->GetContentAttribs().GetItems().ClearItem(); + //#115580# fixed by JingDongChen from China at 2011/11/16 end } IdleFormattter::IdleFormattter()