summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorPedro Giffuni <pfg@apache.org>2011-11-17 14:23:06 +0000
committerPedro Giffuni <pfg@apache.org>2011-11-17 14:23:06 +0000
commitad32df602ca710c6ad45f0d766c5e4398eeaaf14 (patch)
tree383d9e21f70839a2403d386349937020a6ab3f95 /editeng
parent918b5b778652baa921b54bd685beba36776cee3e (diff)
i115580: Fix pasting from sc to sd. Patch by JingDonChen.
Diffstat (limited to 'editeng')
-rwxr-xr-xediteng/source/editeng/impedit.hxx6
-rwxr-xr-xediteng/source/editeng/impedit2.cxx9
-rwxr-xr-xediteng/source/editeng/impedit4.cxx63
-rw-r--r--editeng/source/editeng/impedit5.cxx24
4 files changed, 101 insertions, 1 deletions
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 8b3f39178597..50d408e342ed 100755
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -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;
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 5c235f0d4039..ea79126f35fe 100755
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -133,6 +133,9 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
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( uno::Reference< datatransfer::XTransfer
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( uno::Reference< datatransfer::XTransfer
}
}
}
+ //#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;
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index d464c4182cc8..ea8953a1daa8 100755
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1241,6 +1241,14 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed
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::InsertBinTextObject( BinTextObject& rTextObject, Ed
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::InsertBinTextObject( BinTextObject& rTextObject, Ed
// 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::InsertBinTextObject( BinTextObject& rTextObject, Ed
}
#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::InsertBinTextObject( BinTextObject& rTextObject, Ed
}
}
- 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;
}
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index be74f6eee185..8e41afffccc9 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -813,6 +813,25 @@ void ImpEditEngine::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst )
}
}
+//#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::ParaAttribsToCharAttribs( ContentNode* pNode )
}
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()