incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r1203218 - in /incubator/ooo/trunk/main/editeng/source/editeng: impedit.hxx impedit2.cxx impedit4.cxx impedit5.cxx
Date Thu, 17 Nov 2011 15:23:07 GMT
Author: pfg
Date: Thu Nov 17 15:23:06 2011
New Revision: 1203218

URL: http://svn.apache.org/viewvc?rev=1203218&view=rev
Log:
i115580: Fix pasting from sc to sd. Patch by JingDonChen.

Modified:
    incubator/ooo/trunk/main/editeng/source/editeng/impedit.hxx
    incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx
    incubator/ooo/trunk/main/editeng/source/editeng/impedit4.cxx
    incubator/ooo/trunk/main/editeng/source/editeng/impedit5.cxx

Modified: incubator/ooo/trunk/main/editeng/source/editeng/impedit.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/editeng/source/editeng/impedit.hxx?rev=1203218&r1=1203217&r2=1203218&view=diff
==============================================================================
--- incubator/ooo/trunk/main/editeng/source/editeng/impedit.hxx (original)
+++ incubator/ooo/trunk/main/editeng/source/editeng/impedit.hxx Thu Nov 17 15:23:06 2011
@@ -479,6 +479,9 @@ private:
 	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 @@ private:
 	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;
 

Modified: incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx?rev=1203218&r1=1203217&r2=1203218&view=diff
==============================================================================
--- incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx (original)
+++ incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx Thu Nov 17 15:23:06 2011
@@ -133,6 +133,9 @@ ImpEditEngine::ImpEditEngine( EditEngine
 	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 @@ EditSelection ImpEditEngine::InsertText(
 
 	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 @@ EditSelection ImpEditEngine::InsertText(
 				}
 			}
 		}
+		//#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;

Modified: incubator/ooo/trunk/main/editeng/source/editeng/impedit4.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/editeng/source/editeng/impedit4.cxx?rev=1203218&r1=1203217&r2=1203218&view=diff
==============================================================================
--- incubator/ooo/trunk/main/editeng/source/editeng/impedit4.cxx (original)
+++ incubator/ooo/trunk/main/editeng/source/editeng/impedit4.cxx Thu Nov 17 15:23:06 2011
@@ -1240,7 +1240,15 @@ EditSelection ImpEditEngine::InsertBinTe
 	// 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 @@ EditSelection ImpEditEngine::InsertBinTe
 	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 @@ EditSelection ImpEditEngine::InsertBinTe
 			    // 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 @@ EditSelection ImpEditEngine::InsertBinTe
 		}
 #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 @@ EditSelection ImpEditEngine::InsertBinTe
 		}
 	}
 
-	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;
 }

Modified: incubator/ooo/trunk/main/editeng/source/editeng/impedit5.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/editeng/source/editeng/impedit5.cxx?rev=1203218&r1=1203217&r2=1203218&view=diff
==============================================================================
--- incubator/ooo/trunk/main/editeng/source/editeng/impedit5.cxx (original)
+++ incubator/ooo/trunk/main/editeng/source/editeng/impedit5.cxx Thu Nov 17 15:23:06 2011
@@ -813,6 +813,25 @@ void ImpEditEngine::GetCharAttribs( sal_
 	}
 }
 
+//#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 @@ void ImpEditEngine::ParaAttribsToCharAtt
 	}
 	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()



Mime
View raw message