summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen9.cxx68
-rw-r--r--sc/source/core/data/document.cxx58
-rw-r--r--sc/source/core/data/drwlayer.cxx255
-rw-r--r--sc/source/core/data/table2.cxx9
-rw-r--r--sc/source/ui/app/seltrans.cxx25
-rw-r--r--sc/source/ui/app/transobj.cxx77
-rw-r--r--sc/source/ui/docshell/docfunc.cxx31
-rw-r--r--sc/source/ui/inc/inscodlg.hxx5
-rw-r--r--sc/source/ui/inc/miscdlgs.hrc5
-rw-r--r--sc/source/ui/inc/transobj.hxx8
-rw-r--r--sc/source/ui/inc/undoblk.hxx7
-rw-r--r--sc/source/ui/inc/viewfunc.hxx9
-rw-r--r--sc/source/ui/miscdlgs/inscodlg.cxx18
-rw-r--r--sc/source/ui/src/miscdlgs.src31
-rw-r--r--sc/source/ui/undo/undobase.cxx11
-rw-r--r--sc/source/ui/undo/undoblk.cxx65
-rw-r--r--sc/source/ui/view/cellsh1.cxx8
-rw-r--r--sc/source/ui/view/drawvie4.cxx29
-rw-r--r--sc/source/ui/view/viewfun3.cxx67
19 files changed, 648 insertions, 138 deletions
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index b368a6a39b8e..44d036a3f19a 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: documen9.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: nn $ $Date: 2002-05-08 14:57:39 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:23:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -263,12 +263,21 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
if (pLinkManager)
pDrawLayer->SetLinkManager( pLinkManager );
- // Draw-Pages initialisieren
+ // Drawing pages are accessed by table number, so they must also be present
+ // for preceding table numbers, even if the tables aren't allocated
+ // (important for clipboard documents).
- for (USHORT nTab=0; nTab<=MAXTAB; nTab++)
+ USHORT nDrawPages = 0;
+ USHORT nTab;
+ for (nTab=0; nTab<=MAXTAB; nTab++)
+ if (pTab[nTab])
+ nDrawPages = nTab + 1; // needed number of pages
+
+ for (nTab=0; nTab<nDrawPages; nTab++)
+ {
+ pDrawLayer->ScAddPage( nTab ); // always add page, with or without the table
if (pTab[nTab])
{
- pDrawLayer->ScAddPage( nTab );
String aName;
pTab[nTab]->GetName(aName);
pDrawLayer->ScRenamePage( nTab, aName );
@@ -279,9 +288,10 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
ULONG ny = (ULONG) ((double) (MAXROW+1) * ScGlobal::nStdRowHeight * HMM_PER_TWIPS );
pDrawLayer->SetPageSize( nTab, Size( nx, ny ) );
#endif
- pDrawLayer->SetDefaultTabulator(
- GetDocOptions().GetTabDistance());
}
+ }
+
+ pDrawLayer->SetDefaultTabulator( GetDocOptions().GetTabDistance() );
UpdateDrawPrinter();
UpdateDrawLanguages();
@@ -463,6 +473,50 @@ void ScDocument::DeleteObjectsInSelection( const ScMarkData& rMark )
pDrawLayer->DeleteObjectsInSelection( rMark );
}
+BOOL ScDocument::HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark )
+{
+ // pTabMark is used only for selected tables. If pTabMark is 0, all tables of rRange are used.
+
+ if (!pDrawLayer)
+ return FALSE;
+
+ USHORT nStartTab = 0;
+ USHORT nEndTab = MAXTAB;
+ if ( !pTabMark )
+ {
+ nStartTab = rRange.aStart.Tab();
+ nEndTab = rRange.aEnd.Tab();
+ }
+
+ for (USHORT nTab = nStartTab; nTab <= nEndTab; nTab++)
+ {
+ if ( !pTabMark || pTabMark->GetTableSelect(nTab) )
+ {
+ Rectangle aMMRect = GetMMRect( rRange.aStart.Col(), rRange.aStart.Row(),
+ rRange.aEnd.Col(), rRange.aEnd.Row(), nTab );
+
+ SdrPage* pPage = pDrawLayer->GetPage(nTab);
+ DBG_ASSERT(pPage,"Page ?");
+ if (pPage)
+ {
+ SdrObjListIter aIter( *pPage, IM_FLAT );
+ SdrObject* pObject = aIter.Next();
+ while (pObject)
+ {
+ if ( pObject->GetObjIdentifier() == OBJ_OLE2 &&
+ aMMRect.IsInside( pObject->GetBoundRect() ) )
+ return TRUE;
+
+ pObject = aIter.Next();
+ }
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+
void ScDocument::StopAnimations( USHORT nTab, Window* pWin )
{
if (!pDrawLayer)
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9eb139242f09..5880cd4a3f02 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.cxx,v $
*
- * $Revision: 1.39 $
+ * $Revision: 1.40 $
*
- * last change: $Author: nn $ $Date: 2002-06-27 16:30:16 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:23:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,6 +107,7 @@
#include "chartlis.hxx"
#include "rangelst.hxx"
#include "markdata.hxx"
+#include "drwlayer.hxx"
#include "conditio.hxx"
#include "validat.hxx"
#include "prnsave.hxx"
@@ -1206,7 +1207,8 @@ void ScDocument::UndoToDocument(const ScRange& rRange,
void ScDocument::CopyToClip(USHORT nCol1, USHORT nRow1,
USHORT nCol2, USHORT nRow2,
BOOL bCut, ScDocument* pClipDoc,
- BOOL bAllTabs, const ScMarkData* pMarks, BOOL bKeepScenarioFlags)
+ BOOL bAllTabs, const ScMarkData* pMarks,
+ BOOL bKeepScenarioFlags, BOOL bIncludeObjects)
{
DBG_ASSERT( bAllTabs || pMarks, "CopyToClip: ScMarkData fehlt" );
@@ -1247,8 +1249,18 @@ void ScDocument::CopyToClip(USHORT nCol1, USHORT nRow1,
for (i = 0; i <= MAXTAB; i++)
if (pTab[i] && pClipDoc->pTab[i])
if ( bAllTabs || !pMarks || pMarks->GetTableSelect(i) )
+ {
pTab[i]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[i], bKeepScenarioFlags);
+ if ( pDrawLayer && bIncludeObjects )
+ {
+ // also copy drawing objects
+
+ Rectangle aObjRect = GetMMRect( nCol1, nRow1, nCol2, nRow2, i );
+ pDrawLayer->CopyToClip( pClipDoc, i, aObjRect );
+ }
+ }
+
pClipDoc->bCutMode = bCut;
}
}
@@ -1315,6 +1327,23 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL
pTab[i]->TransposeClip( aClipRange.aStart.Col(), aClipRange.aStart.Row(),
aClipRange.aEnd.Col(), aClipRange.aEnd.Row(),
pTransClip->pTab[i], nFlags, bAsLink );
+
+ if ( pDrawLayer && ( nFlags & IDF_OBJECTS ) )
+ {
+ // Drawing objects are copied to the new area without transposing.
+ // CopyFromClip is used to adjust the objects to the transposed block's
+ // cell range area.
+ // (pDrawLayer in the original clipboard document is set only if there
+ // are drawing objects to copy)
+
+ pTransClip->InitDrawLayer();
+ Rectangle aSourceRect = GetMMRect( aClipRange.aStart.Col(), aClipRange.aStart.Row(),
+ aClipRange.aEnd.Col(), aClipRange.aEnd.Row(), i );
+ Rectangle aDestRect = pTransClip->GetMMRect( 0, 0,
+ aClipRange.aEnd.Row() - aClipRange.aStart.Row(),
+ aClipRange.aEnd.Col() - aClipRange.aStart.Col(), i );
+ pTransClip->pDrawLayer->CopyFromClip( pDrawLayer, i, aSourceRect, ScAddress(0,0,i), aDestRect );
+ }
}
pTransClip->aClipRange = ScRange( 0, 0, aClipRange.aStart.Tab(),
@@ -1383,8 +1412,31 @@ void ScDocument::CopyBlockFromClip( USHORT nCol1, USHORT nRow1,
if (pTab[i] && rMark.GetTableSelect(i) )
{
while (!ppClipTab[nClipTab]) nClipTab = (nClipTab+1) % (MAXTAB+1);
+
pTab[i]->CopyFromClip( nCol1, nRow1, nCol2, nRow2, nDx, nDy,
pCBFCP->nInsFlag, pCBFCP->bAsLink, ppClipTab[nClipTab] );
+
+ if ( pCBFCP->pClipDoc->pDrawLayer && ( pCBFCP->nInsFlag & IDF_OBJECTS ) )
+ {
+ // also copy drawing objects
+
+ // drawing layer must be created before calling CopyFromClip
+ // (ScDocShell::MakeDrawLayer also does InitItems etc.)
+ DBG_ASSERT( pDrawLayer, "CopyBlockFromClip: No drawing layer" );
+ if ( pDrawLayer )
+ {
+ // For GetMMRect, the row heights in the target document must already be valid
+ // (copied in an extra step before pasting, or updated after pasting cells, but
+ // before pasting objects).
+
+ Rectangle aSourceRect = pCBFCP->pClipDoc->GetMMRect(
+ nCol1-nDx, nRow1-nDy, nCol2-nDx, nRow2-nDy, nClipTab );
+ Rectangle aDestRect = GetMMRect( nCol1, nRow1, nCol2, nRow2, i );
+ pDrawLayer->CopyFromClip( pCBFCP->pClipDoc->pDrawLayer, nClipTab, aSourceRect,
+ ScAddress( nCol1, nRow1, i ), aDestRect );
+ }
+ }
+
nClipTab = (nClipTab+1) % (MAXTAB+1);
}
}
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 5bf3163b33d3..25ab5d3af438 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: drwlayer.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: nn $ $Date: 2002-03-04 19:25:17 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:23:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -95,6 +95,9 @@
#include <svtools/itempool.hxx>
#include <vcl/virdev.hxx>
#include <offmgr/app.hxx>
+#include <sch/schdll.hxx>
+#include <sch/schdll0.hxx>
+#include <sch/memchrt.hxx>
#include "drwlayer.hxx"
#include "drawpage.hxx"
@@ -105,6 +108,7 @@
#include "markdata.hxx"
#include "globstr.hrc"
#include "scmod.hxx"
+#include "chartarr.hxx"
#define DET_ARROW_OFFSET 1000
@@ -1103,7 +1107,10 @@ void ScDrawLayer::MoveArea( USHORT nTab, USHORT nCol1,USHORT nRow1, USHORT nCol2
aTopLeft.Y() += aMove.Y();
}
- MoveAreaTwips( nTab, aRect, aMove, aTopLeft );
+ // drawing objects are now directly included in cut&paste
+ // -> only update references when inserting/deleting (or changing widths or heights)
+ if ( bInsDel )
+ MoveAreaTwips( nTab, aRect, aMove, aTopLeft );
//
// Detektiv-Pfeile: Zellpositionen anpassen
@@ -1342,6 +1349,248 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
}
}
+void ScDrawLayer::CopyToClip( ScDocument* pClipDoc, USHORT nTab, const Rectangle& rRange )
+{
+ // copy everything in the specified range into the same page (sheet) in the clipboard doc
+
+ SdrPage* pSrcPage = GetPage(nTab);
+ if (pSrcPage)
+ {
+ ScDrawLayer* pDestModel = NULL;
+ SdrPage* pDestPage = NULL;
+
+ SdrObjListIter aIter( *pSrcPage, IM_FLAT );
+ SdrObject* pOldObject = aIter.Next();
+ while (pOldObject)
+ {
+ Rectangle aObjRect = pOldObject->GetBoundRect();
+ if ( rRange.IsInside( aObjRect ) && pOldObject->GetLayer() != SC_LAYER_INTERN )
+ {
+ if ( !pDestModel )
+ {
+ pDestModel = pClipDoc->GetDrawLayer(); // does the document already have a drawing layer?
+ if ( !pDestModel )
+ {
+ // allocate drawing layer in clipboard document only if there are objects to copy
+
+ pClipDoc->InitDrawLayer(); //! create contiguous pages
+ pDestModel = pClipDoc->GetDrawLayer();
+ }
+ if (pDestModel)
+ pDestPage = pDestModel->GetPage( nTab );
+ }
+
+ DBG_ASSERT( pDestPage, "no page" );
+ if (pDestPage)
+ {
+ SdrObject* pNewObject = pOldObject->Clone( pDestPage, pDestModel );
+ pNewObject->NbcMove(Size(0,0));
+ pDestPage->InsertObject( pNewObject );
+
+ // no undo needed in clipboard document
+ // charts are not updated
+ }
+ }
+
+ pOldObject = aIter.Next();
+ }
+ }
+}
+
+BOOL lcl_IsAllInRange( const ScRangeList& rRanges, const ScRange& rClipRange )
+{
+ // check if every range of rRanges is completely in rClipRange
+
+ ULONG nCount = rRanges.Count();
+ for (ULONG i=0; i<nCount; i++)
+ {
+ ScRange aRange = *rRanges.GetObject(i);
+ if ( !rClipRange.In( aRange ) )
+ {
+ return FALSE; // at least one range is not valid
+ }
+ }
+
+ return TRUE; // everything is fine
+}
+
+BOOL lcl_MoveRanges( ScRangeList& rRanges, const ScRange& rSourceRange, const ScAddress& rDestPos )
+{
+ BOOL bChanged = FALSE;
+
+ ULONG nCount = rRanges.Count();
+ for (ULONG i=0; i<nCount; i++)
+ {
+ ScRange* pRange = rRanges.GetObject(i);
+ if ( rSourceRange.In( *pRange ) )
+ {
+ short nDiffX = rDestPos.Col() - (short)rSourceRange.aStart.Col();
+ short nDiffY = rDestPos.Row() - (short)rSourceRange.aStart.Row();
+ short nDiffZ = rDestPos.Tab() - (short)rSourceRange.aStart.Tab();
+ pRange->Move( nDiffX, nDiffY, nDiffZ );
+ bChanged = TRUE;
+ }
+ }
+
+ return bChanged;
+}
+
+void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, USHORT nSourceTab, const Rectangle& rSourceRange,
+ const ScAddress& rDestPos, const Rectangle& rDestRange )
+{
+ if (!pClipModel)
+ return;
+
+ if (bDrawIsInUndo) //! can this happen?
+ {
+ DBG_ERROR("CopyFromClip, bDrawIsInUndo");
+ return;
+ }
+
+ USHORT nDestTab = rDestPos.Tab();
+
+ SdrPage* pSrcPage = pClipModel->GetPage(nSourceTab);
+ SdrPage* pDestPage = GetPage(nDestTab);
+ DBG_ASSERT( pSrcPage && pDestPage, "draw page missing" );
+ if ( !pSrcPage || !pDestPage )
+ return;
+
+ Size aMove( rDestRange.Left() - rSourceRange.Left(), rDestRange.Top() - rSourceRange.Top() );
+
+ long nDestWidth = rDestRange.GetWidth();
+ long nDestHeight = rDestRange.GetHeight();
+ long nSourceWidth = rSourceRange.GetWidth();
+ long nSourceHeight = rSourceRange.GetHeight();
+
+ long nWidthDiff = nDestWidth - nSourceWidth;
+ long nHeightDiff = nDestHeight - nSourceHeight;
+
+ Fraction aHorFract(1,1);
+ Fraction aVerFract(1,1);
+ BOOL bResize = FALSE;
+ // sizes can differ by 1 from twips->1/100mm conversion for equal cell sizes,
+ // don't resize to empty size when pasting into hidden columns or rows
+ if ( Abs(nWidthDiff) > 1 && nDestWidth > 1 && nSourceWidth > 1 )
+ {
+ aHorFract = Fraction( nDestWidth, nSourceWidth );
+ bResize = TRUE;
+ }
+ if ( Abs(nHeightDiff) > 1 && nDestHeight > 1 && nSourceHeight > 1 )
+ {
+ aVerFract = Fraction( nDestHeight, nSourceHeight );
+ bResize = TRUE;
+ }
+ Point aRefPos = rDestRange.TopLeft(); // for resizing (after moving)
+
+ SdrObjListIter aIter( *pSrcPage, IM_FLAT );
+ SdrObject* pOldObject = aIter.Next();
+ while (pOldObject)
+ {
+ Rectangle aObjRect = pOldObject->GetBoundRect();
+ if ( rSourceRange.IsInside( aObjRect ) )
+ {
+ SdrObject* pNewObject = pOldObject->Clone( pDestPage, this );
+
+ pNewObject->NbcMove( aMove );
+ if ( bResize )
+ pNewObject->NbcResize( aRefPos, aHorFract, aVerFract );
+
+ pDestPage->InsertObject( pNewObject );
+ if (bRecording)
+ AddCalcUndo( new SdrUndoInsertObj( *pNewObject ) );
+
+ // handle chart data references (after InsertObject)
+
+ if ( pNewObject->GetObjIdentifier() == OBJ_OLE2 )
+ {
+ SvInPlaceObjectRef aIPObj = ((SdrOle2Obj*)pNewObject)->GetObjRef();
+ if ( aIPObj.Is() && SchModuleDummy::HasID( *aIPObj->GetSvFactory() ) )
+ {
+ SchMemChart* pChartData = SchDLL::GetChartData(aIPObj);
+ if ( pChartData )
+ {
+ ScChartArray aArray( pDoc, *pChartData ); // parses range description
+ ScRangeListRef xRanges = aArray.GetRangeList();
+ if ( aArray.IsValid() && xRanges.Is() )
+ {
+ ScDocument* pClipDoc = pClipModel->GetDocument();
+
+ // a clipboard document and its source share the same document item pool,
+ // so the pointers can be compared to see if this is copy&paste within
+ // the same document
+ BOOL bSameDoc = pDoc && pClipDoc && pDoc->GetPool() == pClipDoc->GetPool();
+
+ BOOL bDestClip = pDoc && pDoc->IsClipboard();
+
+ BOOL bInSourceRange = FALSE;
+ ScRange aClipRange;
+ if ( pClipDoc )
+ {
+ USHORT nClipStartX, nClipStartY, nClipEndX, nClipEndY;
+ pClipDoc->GetClipStart( nClipStartX, nClipStartY );
+ pClipDoc->GetClipArea( nClipEndX, nClipEndY, TRUE );
+ nClipEndX += nClipStartX;
+ nClipEndY += nClipStartY; // GetClipArea returns the difference
+
+ aClipRange = ScRange( nClipStartX, nClipStartY, nSourceTab,
+ nClipEndX, nClipEndY, nSourceTab );
+
+ bInSourceRange = lcl_IsAllInRange( *xRanges, aClipRange );
+ }
+
+ // always lose references when pasting into a clipboard document (transpose)
+ if ( ( bInSourceRange || bSameDoc ) && !bDestClip )
+ {
+ if ( bInSourceRange )
+ {
+ if ( rDestPos != aClipRange.aStart )
+ {
+ // update the data ranges to the new (copied) position
+ ScRangeListRef xNewRanges = new ScRangeList( *xRanges );
+ if ( lcl_MoveRanges( *xNewRanges, aClipRange, rDestPos ) )
+ {
+ aArray.SetRangeList( xNewRanges );
+ }
+ }
+ }
+ else
+ {
+ // leave the ranges unchanged
+ // Update has to be called anyway because parts of the data may have changed
+ }
+
+ SchMemChart* pMemChart = aArray.CreateMemChart();
+ ScChartArray::CopySettings( *pMemChart, *pChartData );
+ SchDLL::Update( aIPObj, pMemChart );
+ delete pMemChart;
+ }
+ else
+ {
+ // pasting into a new document without the complete source data
+ // -> break connection to source data
+
+ // (see ScDocument::UpdateChartListenerCollection, PastingDrawFromOtherDoc)
+
+ pChartData->SomeData1().Erase();
+ pChartData->SomeData2().Erase();
+ pChartData->SomeData3().Erase();
+ pChartData->SomeData4().Erase();
+ SchChartRange aChartRange;
+ pChartData->SetChartRange( aChartRange );
+ pChartData->SetReadOnly( FALSE );
+ SchDLL::Update( aIPObj, pChartData );
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ pOldObject = aIter.Next();
+ }
+}
+
// static
String ScDrawLayer::GetVisibleName( SdrObject* pObj )
{
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 34c6ceefe17c..b9b22e0e39e8 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: table2.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: dr $ $Date: 2001-10-26 16:44:01 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:23:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -371,16 +371,17 @@ void ScTable::CopyToClip(USHORT nCol1, USHORT nRow1, USHORT nCol2, USHORT nRow2,
aCol[i].CopyToClip(nRow1, nRow2, pTable->aCol[i], bKeepScenarioFlags);
// copy widths/heights, and only "hidden", "filtered" and "manual" flags
+ // also for all preceding columns/rows, to have valid positions for drawing objects
if (pColFlags && pTable->pColFlags && pColWidth && pTable->pColWidth)
- for (i=nCol1; i<=nCol2; i++)
+ for (i=0; i<=nCol2; i++)
{
pTable->pColFlags[i] = pColFlags[i] & CR_HIDDEN;
pTable->pColWidth[i] = pColWidth[i];
}
if (pRowFlags && pTable->pRowFlags && pRowHeight && pTable->pRowHeight)
- for (i=nRow1; i<=nRow2; i++)
+ for (i=0; i<=nRow2; i++)
{
pTable->pRowFlags[i] = pRowFlags[i] & (CR_HIDDEN | CR_FILTERED | CR_MANUALSIZE);
pTable->pRowHeight[i] = pRowHeight[i];
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index e02d3d1de7ec..11f9a9748bd7 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: seltrans.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nn $ $Date: 2001-10-11 10:06:29 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:30:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -307,12 +307,26 @@ void ScSelectionTransferObj::CreateCellData()
// similar to ScViewFunctionSet::BeginDrag
if ( rMark.IsMarked() && !rMark.IsMultiMarked() )
{
+ ScDocShell* pDocSh = pViewData->GetDocShell();
+
+ ScRange aSelRange;
+ rMark.GetMarkArea( aSelRange );
+ ScDocShellRef aDragShellRef;
+ if ( pDocSh->GetDocument()->HasOLEObjectsInArea( aSelRange, &rMark ) )
+ {
+ aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
+ aDragShellRef->DoInitNew(NULL);
+ }
+ ScDrawLayer::SetGlobalDrawPersist(aDragShellRef);
+
ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
// bApi = TRUE -> no error mesages
- BOOL bCopied = pViewData->GetView()->CopyToClip( pClipDoc, FALSE, TRUE );
+ BOOL bCopied = pViewData->GetView()->CopyToClip( pClipDoc, FALSE, TRUE, TRUE );
+
+ ScDrawLayer::SetGlobalDrawPersist(NULL);
+
if ( bCopied )
{
- ScDocShell* pDocSh = pViewData->GetDocShell();
TransferableObjectDescriptor aObjDesc;
pDocSh->FillTransferableObjectDescriptor( aObjDesc );
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
@@ -324,6 +338,9 @@ void ScSelectionTransferObj::CreateCellData()
// SetDragHandlePos is not used - there is no mouse position
//? pTransferObj->SetVisibleTab( nTab );
+ SvEmbeddedObjectRef aPersistRef( aDragShellRef );
+ pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive
+
pTransferObj->SetDragSource( pDocSh, rMark );
pCellData = pTransferObj;
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 609c2a396db0..3588b20d0f06 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: transobj.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: nn $ $Date: 2002-03-04 19:36:44 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:30:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -235,6 +235,8 @@ ScTransferObj::~ScTransferObj()
aDocShellRef.Clear(); // before releasing the mutex
+ aDrawPersistRef.Clear(); // after the model
+
Application::GetSolarMutex().release();
}
@@ -476,7 +478,8 @@ void ScTransferObj::DragFinished( sal_Int8 nDropAction )
if (pSourceSh)
{
ScMarkData aMarkData = GetSourceMarkData();
- pSourceSh->GetDocFunc().DeleteContents( aMarkData, IDF_ALL, TRUE, FALSE );
+ // external drag&drop doesn't copy objects, so they also aren't deleted:
+ pSourceSh->GetDocFunc().DeleteContents( aMarkData, IDF_ALL & ~IDF_OBJECTS, TRUE, FALSE );
}
}
@@ -500,6 +503,11 @@ void ScTransferObj::SetVisibleTab( USHORT nNew )
nVisibleTab = nNew;
}
+void ScTransferObj::SetDrawPersist( const SvEmbeddedObjectRef& rRef )
+{
+ aDrawPersistRef = rRef;
+}
+
void ScTransferObj::SetDragSource( ScDocShell* pSourceShell, const ScMarkData& rMark )
{
ScRangeList aRanges;
@@ -567,31 +575,15 @@ void ScTransferObj::InitDocShell()
pDoc->GetName( aBlock.aStart.Tab(), aTabName );
pDestDoc->RenameTab( 0, aTabName, FALSE ); // no UpdateRef (empty)
- // cell range is copied to the original position, but on the first sheet
- // -> bCutMode must be set
- // pDoc is always a Clipboard-document
-
pDestDoc->CopyStdStylesFrom( pDoc );
USHORT nStartX = aBlock.aStart.Col();
USHORT nStartY = aBlock.aStart.Row();
USHORT nEndX = aBlock.aEnd.Col();
USHORT nEndY = aBlock.aEnd.Row();
- ScRange aDestRange( nStartX,nStartY,0, nEndX,nEndY,0 );
- BOOL bWasCut = pDoc->IsCutMode();
- if (!bWasCut)
- pDoc->SetClipArea( aDestRange, TRUE ); // Cut
- pDestDoc->CopyFromClip( aDestRange, aDestMark, IDF_ALL, NULL, pDoc, FALSE );
- pDoc->SetClipArea( aDestRange, bWasCut );
-
- StripRefs( pDoc, nStartX,nStartY, nEndX,nEndY, pDestDoc, 0,0 );
-
- ScRange aMergeRange = aDestRange;
- pDestDoc->ExtendMerge( aMergeRange, TRUE );
-
- pDoc->CopyDdeLinks( pDestDoc ); // copy values of DDE Links
// widths / heights
+ // (must be copied before CopyFromClip, for drawing objects)
USHORT nCol;
USHORT nRow;
@@ -616,6 +608,27 @@ void ScTransferObj::InitDocShell()
}
}
+ if ( pDoc->GetDrawLayer() )
+ pDocSh->MakeDrawLayer();
+
+ // cell range is copied to the original position, but on the first sheet
+ // -> bCutMode must be set
+ // pDoc is always a Clipboard-document
+
+ ScRange aDestRange( nStartX,nStartY,0, nEndX,nEndY,0 );
+ BOOL bWasCut = pDoc->IsCutMode();
+ if (!bWasCut)
+ pDoc->SetClipArea( aDestRange, TRUE ); // Cut
+ pDestDoc->CopyFromClip( aDestRange, aDestMark, IDF_ALL, NULL, pDoc, FALSE );
+ pDoc->SetClipArea( aDestRange, bWasCut );
+
+ StripRefs( pDoc, nStartX,nStartY, nEndX,nEndY, pDestDoc, 0,0 );
+
+ ScRange aMergeRange = aDestRange;
+ pDestDoc->ExtendMerge( aMergeRange, TRUE );
+
+ pDoc->CopyDdeLinks( pDestDoc ); // copy values of DDE Links
+
// page format (grid etc) and page size (maximum size for ole object)
Size aPaperSize = SvxPaperInfo::GetPaperSize( SVX_PAPER_A4 ); // Twips
@@ -682,6 +695,30 @@ void ScTransferObj::InitDocShell()
pDocSh->SetVisArea( aNewArea );
pDocSh->UpdateOle(&aViewData, TRUE);
+
+ //! SetDocumentModified?
+ if ( pDestDoc->IsChartListenerCollectionNeedsUpdate() )
+ pDestDoc->UpdateChartListenerCollection();
+ }
+}
+
+// static
+SvPersist* ScTransferObj::SetDrawClipDoc( BOOL bAnyOle )
+{
+ // update ScGlobal::pDrawClipDocShellRef
+
+ delete ScGlobal::pDrawClipDocShellRef;
+ if (bAnyOle)
+ {
+ ScGlobal::pDrawClipDocShellRef =
+ new ScDocShellRef(new ScDocShell); // there must be a ref
+ (*ScGlobal::pDrawClipDocShellRef)->DoInitNew(NULL);
+ return *ScGlobal::pDrawClipDocShellRef;
+ }
+ else
+ {
+ ScGlobal::pDrawClipDocShellRef = NULL;
+ return NULL;
}
}
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index eb9473f68f2e..cf21de40c9ce 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docfunc.cxx,v $
*
- * $Revision: 1.29 $
+ * $Revision: 1.30 $
*
- * last change: $Author: sab $ $Date: 2002-05-03 12:13:31 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:32:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1679,8 +1679,18 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
aSourceMark.SelectTable( nTab, TRUE ); // Source selektieren
aSourceMark.SetMarkArea( rSource );
+ ScDocShellRef aDragShellRef;
+ if ( pDoc->HasOLEObjectsInArea( rSource ) )
+ {
+ aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
+ aDragShellRef->DoInitNew(NULL);
+ }
+ ScDrawLayer::SetGlobalDrawPersist(aDragShellRef);
+
pDoc->CopyToClip( nStartCol, nStartRow, nEndCol, nEndRow, bCut, pClipDoc,
- FALSE, &aSourceMark, bScenariosAdded );
+ FALSE, &aSourceMark, bScenariosAdded, TRUE );
+
+ ScDrawLayer::SetGlobalDrawPersist(NULL);
USHORT nOldEndCol = nEndCol;
USHORT nOldEndRow = nEndRow;
@@ -1794,9 +1804,13 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
BOOL bSourceHeight = FALSE; // Hoehen angepasst?
if (bCut)
{
+ ScMarkData aDelMark; // only for tables
for (nTab=nStartTab; nTab<=nEndTab; nTab++)
+ {
pDoc->DeleteAreaTab( nStartCol,nStartRow, nOldEndCol,nOldEndRow, nTab, IDF_ALL );
-//!!! pDoc->DeleteAreaTab( nStartCol,nStartRow, nEndCol,nEndRow, nStartTab, IDF_ALL );
+ aDelMark.SelectTable( nTab, TRUE );
+ }
+ pDoc->DeleteObjectsInArea( nStartCol,nStartRow, nOldEndCol,nOldEndRow, aDelMark );
// Test auf zusammengefasste
@@ -1834,8 +1848,8 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
aDestMark.SelectTable( nTab, TRUE ); // Destination selektieren
aDestMark.SetMarkArea( aPasteDest );
- //! markierte Tabellen bei CopyFromClip uebergeben !!!!!
- pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_ALL, pRefUndoDoc, pClipDoc, TRUE, FALSE, bIncludeFiltered );
+ pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_ALL & ~IDF_OBJECTS,
+ pRefUndoDoc, pClipDoc, TRUE, FALSE, bIncludeFiltered );
// skipped rows and merged cells don't mix
if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
@@ -1846,6 +1860,11 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
ScRange( 0,nDestRow,nDestTab, MAXCOL,nDestEndRow,nDestEndTab ),
FALSE );
+ // paste drawing objects after adjusting row heights
+ if ( pClipDoc->GetDrawLayer() )
+ pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_OBJECTS,
+ pRefUndoDoc, pClipDoc, TRUE, FALSE, bIncludeFiltered );
+
if (bRecord)
{
if (pRefUndoDoc)
diff --git a/sc/source/ui/inc/inscodlg.hxx b/sc/source/ui/inc/inscodlg.hxx
index 3836ca21aafb..dfc12682404f 100644
--- a/sc/source/ui/inc/inscodlg.hxx
+++ b/sc/source/ui/inc/inscodlg.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: inscodlg.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2001-05-23 10:52:56 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:25:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -115,6 +115,7 @@ private:
CheckBox aBtnInsFormulas;
CheckBox aBtnInsNotes;
CheckBox aBtnInsAttrs;
+ CheckBox aBtnInsObjects;
FixedLine aFlSep1;
FixedLine aFlOptions;
diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc
index 8dfdec202873..03a11f6bd411 100644
--- a/sc/source/ui/inc/miscdlgs.hrc
+++ b/sc/source/ui/inc/miscdlgs.hrc
@@ -2,9 +2,9 @@
*
* $RCSfile: miscdlgs.hrc,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: dr $ $Date: 2002-07-11 10:52:44 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:25:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -135,6 +135,7 @@
#define BTN_MV_DOWN 38
#define BTN_MV_RIGHT 39
#define FL_MOVE 40
+#define BTN_INSOBJECTS 41
#define FL_SEP1 51
#define FL_SEP2 52
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index a641360e1df4..15725b01780b 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: transobj.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: nn $ $Date: 2001-10-19 12:09:33 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:25:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -93,6 +93,7 @@ private:
TransferableDataHelper aOleData;
TransferableObjectDescriptor aObjDesc;
SvEmbeddedObjectRef aDocShellRef;
+ SvEmbeddedObjectRef aDrawPersistRef;
com::sun::star::uno::Reference<com::sun::star::sheet::XSheetCellRanges> xDragSourceRanges;
USHORT nDragHandleX;
USHORT nDragHandleY;
@@ -132,6 +133,7 @@ public:
ScDocument* GetSourceDocument();
ScMarkData GetSourceMarkData();
+ void SetDrawPersist( const SvEmbeddedObjectRef& rRef );
void SetDragHandlePos( USHORT nX, USHORT nY );
void SetVisibleTab( USHORT nNew );
void SetDragSource( ScDocShell* pSourceShell, const ScMarkData& rMark );
@@ -139,6 +141,8 @@ public:
void SetDragWasInternal();
static ScTransferObj* GetOwnClipboard( Window* pUIWin );
+
+ static SvPersist* SetDrawClipDoc( BOOL bAnyOle ); // update ScGlobal::pDrawClipDocShellRef
};
#endif
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index b7481531a529..2d6760cde92d 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: undoblk.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: nn $ $Date: 2002-04-19 17:14:17 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:25:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -194,7 +194,7 @@ private:
};
-class ScUndoPaste: public ScSimpleUndo
+class ScUndoPaste: public ScBlockUndo
{
public:
TYPEINFO();
@@ -216,7 +216,6 @@ public:
virtual String GetComment() const;
private:
- ScRange aRange;
ScMarkData aMarkData;
ScDocument* pUndoDoc;
ScDocument* pRedoDoc;
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 7b4ec4a27e40..fcd9062b04b5 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewfunc.hxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: nn $ $Date: 2001-10-26 18:15:30 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:25:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -140,8 +140,9 @@ public:
void EnterDataAtCursor( const String& rString ); //! nicht benutzt ?
- void CutToClip( ScDocument* pClipDoc=NULL );
- BOOL CopyToClip( ScDocument* pClipDoc=NULL, BOOL bCut = FALSE, BOOL bApi = FALSE );
+ void CutToClip( ScDocument* pClipDoc = NULL, BOOL bIncludeObjects = FALSE );
+ BOOL CopyToClip( ScDocument* pClipDoc = NULL, BOOL bCut = FALSE, BOOL bApi = FALSE,
+ BOOL bIncludeObjects = FALSE );
BOOL PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
USHORT nFunction = PASTE_NOFUNC, BOOL bSkipEmpty = FALSE,
BOOL bTranspose = FALSE, BOOL bAsLink = FALSE,
diff --git a/sc/source/ui/miscdlgs/inscodlg.cxx b/sc/source/ui/miscdlgs/inscodlg.cxx
index a77130133a1a..9f8d85223902 100644
--- a/sc/source/ui/miscdlgs/inscodlg.cxx
+++ b/sc/source/ui/miscdlgs/inscodlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: inscodlg.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2001-05-23 10:50:15 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:33:42 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,7 +77,7 @@
BOOL ScInsertContentsDlg::bPreviousAllCheck = TRUE;
USHORT ScInsertContentsDlg::nPreviousChecks = (IDF_DATETIME | IDF_STRING |
IDF_NOTE | IDF_FORMULA |
- IDF_ATTRIB);
+ IDF_ATTRIB | IDF_OBJECTS);
USHORT ScInsertContentsDlg::nPreviousFormulaChecks = PASTE_NOFUNC;
USHORT ScInsertContentsDlg::nPreviousChecks2 = 0;
USHORT ScInsertContentsDlg::nPreviousMoveMode = INS_NONE; // enum InsCellCmd
@@ -100,6 +100,7 @@ ScInsertContentsDlg::ScInsertContentsDlg( Window* pParent,
aBtnInsFormulas ( this, ScResId( BTN_INSFORMULAS ) ),
aBtnInsNotes ( this, ScResId( BTN_INSNOTES ) ),
aBtnInsAttrs ( this, ScResId( BTN_INSATTRS ) ),
+ aBtnInsObjects ( this, ScResId( BTN_INSOBJECTS ) ),
aFlFrame ( this, ScResId( FL_FRAME ) ),
aBtnSkipEmptyCells( this, ScResId(BTN_SKIP_EMPTY ) ),
aBtnTranspose ( this, ScResId( BTN_TRANSPOSE ) ),
@@ -146,6 +147,8 @@ ScInsertContentsDlg::ScInsertContentsDlg( Window* pParent,
ScInsertContentsDlg::nPreviousChecks ) );
aBtnInsAttrs.Check ( IS_SET( IDF_ATTRIB,
ScInsertContentsDlg::nPreviousChecks ) );
+ aBtnInsObjects.Check ( IS_SET( IDF_OBJECTS,
+ ScInsertContentsDlg::nPreviousChecks ) );
switch( ScInsertContentsDlg::nPreviousFormulaChecks )
{
@@ -197,6 +200,8 @@ USHORT ScInsertContentsDlg::GetInsContentsCmdBits() const
ScInsertContentsDlg::nPreviousChecks |= IDF_NOTE;
if ( aBtnInsAttrs.IsChecked() )
ScInsertContentsDlg::nPreviousChecks |= IDF_ATTRIB;
+ if ( aBtnInsObjects.IsChecked() )
+ ScInsertContentsDlg::nPreviousChecks |= IDF_OBJECTS;
ScInsertContentsDlg::bPreviousAllCheck = aBtnInsAll.IsChecked();
@@ -229,6 +234,7 @@ void ScInsertContentsDlg::DisableChecks( BOOL bInsAllChecked )
aBtnInsFormulas.Disable();
aBtnInsNotes.Disable();
aBtnInsAttrs.Disable();
+ aBtnInsObjects.Disable();
}
else
{
@@ -238,6 +244,12 @@ void ScInsertContentsDlg::DisableChecks( BOOL bInsAllChecked )
aBtnInsFormulas.Enable();
aBtnInsNotes.Enable();
aBtnInsAttrs.Enable();
+
+ // "Objects" is disabled for "Fill Tables"
+ if ( bFillMode )
+ aBtnInsObjects.Disable();
+ else
+ aBtnInsObjects.Enable();
}
}
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index f675d0d5c375..3b5be5e59184 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -2,9 +2,9 @@
*
* $RCSfile: miscdlgs.src,v $
*
- * $Revision: 1.49 $
+ * $Revision: 1.50 $
*
- * last change: $Author: dr $ $Date: 2002-07-11 10:56:30 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:34:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -827,7 +827,7 @@ ModalDialog RID_SCDLG_INSCONT
OutputSize = TRUE ;
HelpId = FID_INS_CELL_CONTENTS ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 260 , 173 ) ;
+ Size = MAP_APPFONT ( 260 , 187 ) ;
/* ### ACHTUNG: Neuer Text in Resource? Inhalte einfgen : Inhalte einfgen */
Text = "Inhalte einfgen" ;
Text [ ENGLISH ] = "Insert Contents" ;
@@ -1050,6 +1050,15 @@ ModalDialog RID_SCDLG_INSCONT
Text[ catalan ] = "For~mats";
Text[ thai ] = "รูปแ~บบ";
};
+ CheckBox BTN_INSOBJECTS
+ {
+ Pos = MAP_APPFONT ( 12 , 114 ) ;
+ Size = MAP_APPFONT ( 84 , 10 ) ;
+ Text = "O~bjekte" ;
+ Text [ ENGLISH ] = "O~bjects" ;
+ Text [ english_us ] = "O~bjects" ;
+ TabStop = TRUE ;
+ };
CheckBox BTN_INSNOTES
{
Pos = MAP_APPFONT ( 12 , 86 ) ;
@@ -1287,7 +1296,7 @@ ModalDialog RID_SCDLG_INSCONT
};
CheckBox BTN_SKIP_EMPTY
{
- Pos = MAP_APPFONT ( 12 , 127 ) ;
+ Pos = MAP_APPFONT ( 12 , 141 ) ;
Size = MAP_APPFONT ( 84 , 10 ) ;
/* ### ACHTUNG: Neuer Text in Resource? ~Leerzellen berspringen : ~Leerzellen berspringen */
Text = "~Leerzellen berspringen" ;
@@ -1317,7 +1326,7 @@ ModalDialog RID_SCDLG_INSCONT
};
CheckBox BTN_TRANSPOSE
{
- Pos = MAP_APPFONT ( 12 , 141 ) ;
+ Pos = MAP_APPFONT ( 12 , 155 ) ;
Size = MAP_APPFONT ( 84 , 10 ) ;
Text = "Transp~onieren" ;
Text [ ENGLISH ] = "~Tranpose" ;
@@ -1346,7 +1355,7 @@ ModalDialog RID_SCDLG_INSCONT
};
CheckBox BTN_LINK
{
- Pos = MAP_APPFONT ( 12 , 155 ) ;
+ Pos = MAP_APPFONT ( 12 , 169 ) ;
Size = MAP_APPFONT ( 84 , 10 ) ;
/* ### ACHTUNG: Neuer Text in Resource? Verkn~pfen : Verkn~pfen */
Text = "Verkn~pfen" ;
@@ -1376,7 +1385,7 @@ ModalDialog RID_SCDLG_INSCONT
};
FixedLine FL_OPTIONS
{
- Pos = MAP_APPFONT ( 6 , 116 ) ;
+ Pos = MAP_APPFONT ( 6 , 130 ) ;
Size = MAP_APPFONT ( 93 , 8 ) ;
Text = "Optionen" ;
Text [ ENGLISH ] = "Options" ;
@@ -1405,7 +1414,7 @@ ModalDialog RID_SCDLG_INSCONT
};
RadioButton BTN_MV_NONE
{
- Pos = MAP_APPFONT ( 111 , 127 ) ;
+ Pos = MAP_APPFONT ( 111 , 141 ) ;
Size = MAP_APPFONT ( 83 , 10 ) ;
Text = "Nicht ~verschieben" ;
Text [ ENGLISH ] = "~None" ;
@@ -1434,7 +1443,7 @@ ModalDialog RID_SCDLG_INSCONT
};
RadioButton BTN_MV_DOWN
{
- Pos = MAP_APPFONT ( 111 , 141 ) ;
+ Pos = MAP_APPFONT ( 111 , 155 ) ;
Size = MAP_APPFONT ( 83 , 10 ) ;
Text = "Nach ~unten" ;
Text [ ENGLISH ] = "~Down" ;
@@ -1463,7 +1472,7 @@ ModalDialog RID_SCDLG_INSCONT
};
RadioButton BTN_MV_RIGHT
{
- Pos = MAP_APPFONT ( 111 , 155 ) ;
+ Pos = MAP_APPFONT ( 111 , 169 ) ;
Size = MAP_APPFONT ( 83 , 10 ) ;
Text = "Nach re~chts" ;
Text [ ENGLISH ] = "~Right" ;
@@ -1492,7 +1501,7 @@ ModalDialog RID_SCDLG_INSCONT
};
FixedLine FL_MOVE
{
- Pos = MAP_APPFONT ( 105 , 116 ) ;
+ Pos = MAP_APPFONT ( 105 , 130 ) ;
Size = MAP_APPFONT ( 93 , 8 ) ;
Text = "Zellen verschieben" ;
Text [ ENGLISH ] = "Move cells" ;
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 2c952af778f9..dc3af3918a04 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: undobase.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:45:07 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:31:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -125,13 +125,14 @@ void ScSimpleUndo::BeginUndo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->HideAllCursors(); // z.B. wegen zusammengefassten Zellen
-}
-void ScSimpleUndo::EndUndo()
-{
+ // detective updates happened last, must be undone first
if (pDetectiveUndo)
pDetectiveUndo->Undo();
+}
+void ScSimpleUndo::EndUndo()
+{
pDocShell->SetDocumentModified();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 52479ffc4e9b..2f84fdef4998 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: undoblk.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: nn $ $Date: 2002-04-19 17:15:04 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:31:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,6 +100,7 @@
#include "chgtrack.hxx"
#include "transobj.hxx"
#include "refundo.hxx"
+#include "undoolk.hxx"
// STATIC DATA -----------------------------------------------------------
@@ -695,6 +696,9 @@ void ScUndoCut::DoChange( const BOOL bUndo )
if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
/*A*/ pDocShell->PostPaint( aExtendedRange, PAINT_GRID, nExtFlags );
+ if ( pDrawUndo && !bUndo ) // draw redo after updating row heights
+ RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
+
pDocShell->PostDataChanged();
if (pViewShell)
pViewShell->CellContentChanged();
@@ -710,14 +714,17 @@ void __EXPORT ScUndoCut::Undo()
void __EXPORT ScUndoCut::Redo()
{
BeginRedo();
+ ScDocument* pDoc = pDocShell->GetDocument();
+ EnableDrawAdjust( pDoc, FALSE ); //! include in ScBlockUndo?
DoChange( FALSE );
+ EnableDrawAdjust( pDoc, TRUE ); //! include in ScBlockUndo?
EndRedo();
}
void __EXPORT ScUndoCut::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->CutToClip();
+ ((ScTabViewTarget&)rTarget).GetViewShell()->CutToClip( NULL, TRUE );
}
BOOL __EXPORT ScUndoCut::CanRepeat(SfxRepeatTarget& rTarget) const
@@ -740,8 +747,7 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pNewDocShell,
ScRefUndoData* pRefData,
void* pFill1, void* pFill2, void* pFill3,
BOOL bRedoIsFilled ) :
- ScSimpleUndo( pNewDocShell ),
- aRange( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
+ ScBlockUndo( pNewDocShell, ScRange( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ), SC_UNDO_SIMPLE ),
aMarkData( rMark ),
pUndoDoc( pNewUndoDoc ),
pRedoDoc( pNewRedoDoc ),
@@ -754,8 +760,8 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pNewDocShell,
// don't have to be changed and branched for 641.
// They can be removed later.
- if ( !aMarkData.IsMarked() ) // keine Zelle markiert:
- aMarkData.SetMarkArea( aRange ); // Paste-Block markieren
+ if ( !aMarkData.IsMarked() ) // no cell marked:
+ aMarkData.SetMarkArea( aBlockRange ); // mark paste block
if ( pRefUndoData )
pRefUndoData->DeleteUnchanged( pDocShell->GetDocument() );
@@ -780,7 +786,7 @@ void ScUndoPaste::SetChangeTrack()
{
ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
- pChangeTrack->AppendContentRange( aRange, pUndoDoc,
+ pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
nStartChangeAction, nEndChangeAction, SC_CACM_PASTE );
else
nStartChangeAction = nEndChangeAction = 0;
@@ -809,36 +815,37 @@ void ScUndoPaste::DoChange( const BOOL bUndo )
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- ScUndoUtil::MarkSimpleBlock( pDocShell, aRange );
+ // marking is in ScBlockUndo...
+ ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockRange );
if ( bUndo && !bRedoFilled )
{
if (!pRedoDoc)
{
- BOOL bColInfo = ( aRange.aStart.Row()==0 && aRange.aEnd.Row()==MAXROW );
- BOOL bRowInfo = ( aRange.aStart.Col()==0 && aRange.aEnd.Col()==MAXCOL );
+ BOOL bColInfo = ( aBlockRange.aStart.Row()==0 && aBlockRange.aEnd.Row()==MAXROW );
+ BOOL bRowInfo = ( aBlockRange.aStart.Col()==0 && aBlockRange.aEnd.Col()==MAXCOL );
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aStart.Tab(),
+ pRedoDoc->InitUndo( pDoc, aBlockRange.aStart.Tab(), aBlockRange.aStart.Tab(),
bColInfo, bRowInfo );
}
// Redo-Daten beim ersten Undo aus dem Dokument lesen
- pDoc->CopyToDocument( aRange, nUndoFlags, FALSE, pRedoDoc );
+ pDoc->CopyToDocument( aBlockRange, nUndoFlags, FALSE, pRedoDoc );
bRedoFilled = TRUE;
}
- BOOL bHasLines = pDoc->HasAttrib( aRange, HASATTR_PAINTEXT );
+ BOOL bHasLines = pDoc->HasAttrib( aBlockRange, HASATTR_PAINTEXT );
aMarkData.MarkToMulti();
pDoc->DeleteSelection( nUndoFlags, aMarkData );
aMarkData.MarkToSimple();
if ( !bUndo && pRedoDoc ) // Redo: UndoToDocument vorher
- pRedoDoc->UndoToDocument( aRange, nUndoFlags, FALSE, pDoc );
+ pRedoDoc->UndoToDocument( aBlockRange, nUndoFlags, FALSE, pDoc );
if (pWorkRefData)
{
pWorkRefData->DoUndo( pDoc, TRUE ); // TRUE = bSetChartRangeLists for SetChartListenerCollection
- if ( pDoc->RefreshAutoFilter( 0,0, MAXCOL,MAXROW, aRange.aStart.Tab() ) )
+ if ( pDoc->RefreshAutoFilter( 0,0, MAXCOL,MAXROW, aBlockRange.aStart.Tab() ) )
bPaintAll = TRUE;
}
@@ -846,7 +853,7 @@ void ScUndoPaste::DoChange( const BOOL bUndo )
pRefRedoData->DeleteUnchanged( pDoc );
if (bUndo) // Undo: UndoToDocument hinterher
- pUndoDoc->UndoToDocument( aRange, nUndoFlags, FALSE, pDoc );
+ pUndoDoc->UndoToDocument( aBlockRange, nUndoFlags, FALSE, pDoc );
if ( bUndo )
{
@@ -857,7 +864,7 @@ void ScUndoPaste::DoChange( const BOOL bUndo )
else
SetChangeTrack();
- ScRange aDrawRange( aRange );
+ ScRange aDrawRange( aBlockRange );
USHORT nPaint = PAINT_GRID;
USHORT nPaintExt = 0;
if (bPaintAll)
@@ -872,12 +879,12 @@ void ScUndoPaste::DoChange( const BOOL bUndo )
}
else
{
- if ( aRange.aStart.Row() == 0 && aRange.aEnd.Row() == MAXROW ) // ganze Spalte
+ if ( aBlockRange.aStart.Row() == 0 && aBlockRange.aEnd.Row() == MAXROW ) // ganze Spalte
{
nPaint |= PAINT_TOP;
aDrawRange.aEnd.SetCol(MAXCOL);
}
- if ( aRange.aStart.Col() == 0 && aRange.aEnd.Col() == MAXCOL ) // ganze Zeile
+ if ( aBlockRange.aStart.Col() == 0 && aBlockRange.aEnd.Col() == MAXCOL ) // ganze Zeile
{
nPaint |= PAINT_LEFT;
aDrawRange.aEnd.SetRow(MAXROW);
@@ -893,6 +900,10 @@ void ScUndoPaste::DoChange( const BOOL bUndo )
bHasLines |= pDoc->HasAttrib( aDrawRange, HASATTR_PAINTEXT );
if (bHasLines) nPaintExt = SC_PF_LINES;
}
+
+ if ( pDrawUndo && !bUndo ) // draw redo after updating row heights
+ RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
+
pDocShell->PostPaint( aDrawRange, nPaint, nPaintExt );
pDocShell->PostDataChanged();
@@ -904,14 +915,17 @@ void __EXPORT ScUndoPaste::Undo()
{
BeginUndo();
DoChange( TRUE );
- ShowTable( aRange );
+ ShowTable( aBlockRange );
EndUndo();
}
void __EXPORT ScUndoPaste::Redo()
{
BeginRedo();
+ ScDocument* pDoc = pDocShell->GetDocument();
+ EnableDrawAdjust( pDoc, FALSE ); //! include in ScBlockUndo?
DoChange( FALSE );
+ EnableDrawAdjust( pDoc, TRUE ); //! include in ScBlockUndo?
EndRedo();
}
@@ -1092,6 +1106,8 @@ void __EXPORT ScUndoDragDrop::Redo()
ScDocument* pDoc = pDocShell->GetDocument();
ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
+ EnableDrawAdjust( pDoc, FALSE ); //! include in ScBlockUndo?
+
USHORT nTab;
ScMarkData aSourceMark;
for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++)
@@ -1113,7 +1129,7 @@ void __EXPORT ScUndoDragDrop::Redo()
aDestMark.SelectTable( nTab, TRUE );
BOOL bIncludeFiltered = bCut;
- pDoc->CopyFromClip( aDestRange, aDestMark, IDF_ALL, NULL, pClipDoc, TRUE, FALSE, bIncludeFiltered );
+ pDoc->CopyFromClip( aDestRange, aDestMark, IDF_ALL & ~IDF_OBJECTS, NULL, pClipDoc, TRUE, FALSE, bIncludeFiltered );
// skipped rows and merged cells don't mix
if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
@@ -1133,6 +1149,11 @@ void __EXPORT ScUndoDragDrop::Redo()
delete pClipDoc;
ShowTable( aDestRange.aStart.Tab() );
+
+ if ( pDrawUndo )
+ RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
+ EnableDrawAdjust( pDoc, TRUE ); //! include in ScBlockUndo?
+
EndRedo();
}
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 8b97b52665bf..7d64432640a8 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cellsh1.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: mba $ $Date: 2002-07-12 16:42:19 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:29:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1045,7 +1045,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_COPY: // fuer Grafiken in DrawShell
{
WaitObject aWait( GetViewData()->GetDialogParent() );
- pTabViewShell->CopyToClip();
+ pTabViewShell->CopyToClip( NULL, FALSE, FALSE, TRUE );
rReq.Done();
}
break;
@@ -1053,7 +1053,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_CUT: // fuer Grafiken in DrawShell
{
WaitObject aWait( GetViewData()->GetDialogParent() );
- pTabViewShell->CutToClip();
+ pTabViewShell->CutToClip( NULL, TRUE );
rReq.Done();
}
break;
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index d73503b28384..4a9be4db34a3 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: drawvie4.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: er $ $Date: 2001-10-25 17:46:44 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:29:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,8 +84,8 @@
#include "viewdata.hxx"
#include "document.hxx"
#include "docsh.hxx"
-//#include "dataobj.hxx"
#include "drwtrans.hxx"
+#include "transobj.hxx" // SetDrawClipDoc
#include "drawutil.hxx"
#include "scmod.hxx"
#include "globstr.hrc"
@@ -181,15 +181,12 @@ BOOL ScDrawView::BeginDrag( Window* pWindow, const Point& rStartPos )
const SdrMarkList& rMarkList = GetMarkList();
lcl_CheckOle( rMarkList, bAnyOle, bOneOle );
- //---------------------------------------------------------
ScDocShellRef aDragShellRef;
if (bAnyOle)
{
- aDragShellRef = new ScDocShell; // ohne Ref lebt die DocShell nicht !!!
+ aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
aDragShellRef->DoInitNew(NULL);
}
- //---------------------------------------------------------
-
ScDrawLayer::SetGlobalDrawPersist(aDragShellRef);
SdrModel* pModel = GetAllMarkedModel();
ScDrawLayer::SetGlobalDrawPersist(NULL);
@@ -227,22 +224,8 @@ void ScDrawView::DoCopy()
const SdrMarkList& rMarkList = GetMarkList();
lcl_CheckOle( rMarkList, bAnyOle, bOneOle );
- //---------------------------------------------------------
- delete ScGlobal::pDrawClipDocShellRef;
- if (bAnyOle)
- {
- ScGlobal::pDrawClipDocShellRef =
- new ScDocShellRef(new ScDocShell); // ohne Ref geht's nicht
- (*ScGlobal::pDrawClipDocShellRef)->DoInitNew(NULL);
- ScDrawLayer::SetGlobalDrawPersist(*ScGlobal::pDrawClipDocShellRef);
- }
- else
- {
- ScGlobal::pDrawClipDocShellRef = NULL;
- ScDrawLayer::SetGlobalDrawPersist(NULL);
- }
- //---------------------------------------------------------
-
+ // update ScGlobal::pDrawClipDocShellRef
+ ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
SdrModel* pModel = GetAllMarkedModel();
ScDrawLayer::SetGlobalDrawPersist(NULL);
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 79229c0ca157..997f9e8d2f90 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewfun3.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: nn $ $Date: 2002-04-19 17:15:43 $
+ * last change: $Author: nn $ $Date: 2002-07-15 14:29:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -236,6 +236,7 @@
#include "waitoff.hxx"
#include "scmod.hxx"
#include "sc.hrc"
+#include "drwlayer.hxx"
using namespace com::sun::star;
@@ -249,7 +250,7 @@ using namespace com::sun::star;
//----------------------------------------------------------------------------
// C U T
-void ScViewFunc::CutToClip( ScDocument* pClipDoc )
+void ScViewFunc::CutToClip( ScDocument* pClipDoc, BOOL bIncludeObjects )
{
UpdateInputLine();
@@ -276,7 +277,7 @@ void ScViewFunc::CutToClip( ScDocument* pClipDoc )
rMark.SetMarkArea( aRange );
}
- CopyToClip( pClipDoc, TRUE ); // Ab ins Clipboard
+ CopyToClip( pClipDoc, TRUE, FALSE, bIncludeObjects ); // Ab ins Clipboard
ScAddress aOldEnd( aRange.aEnd ); // Zusammengefasste Zellen im Bereich?
pDoc->ExtendMerge( aRange, TRUE );
@@ -298,6 +299,8 @@ void ScViewFunc::CutToClip( ScDocument* pClipDoc )
rMark.MarkToMulti();
pDoc->DeleteSelection( IDF_ALL, rMark );
+ if ( bIncludeObjects )
+ pDoc->DeleteObjectsInSelection( rMark );
rMark.MarkToSimple();
if ( !AdjustRowHeight( aRange.aStart.Row(), aRange.aEnd.Row() ) )
@@ -321,7 +324,7 @@ void ScViewFunc::CutToClip( ScDocument* pClipDoc )
//----------------------------------------------------------------------------
// C O P Y
-BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi )
+BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bIncludeObjects )
{
BOOL bDone = FALSE;
UpdateInputLine();
@@ -350,11 +353,22 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi )
pChangeTrack->ResetLastCut(); // kein CutMode mehr
}
+ if ( bSysClip && bIncludeObjects )
+ {
+ BOOL bAnyOle = pDoc->HasOLEObjectsInArea( aRange, &rMark );
+ // update ScGlobal::pDrawClipDocShellRef
+ ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
+ }
+
pDoc->CopyToClip( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
- bCut, pClipDoc, FALSE, &rMark );
+ bCut, pClipDoc, FALSE, &rMark, FALSE, bIncludeObjects );
if (bSysClip)
+ {
+ ScDrawLayer::SetGlobalDrawPersist(NULL);
+
ScGlobal::SetClipDocName( pDoc->GetDocumentShell()->GetTitle( SFX_TITLE_FULLNAME ) );
+ }
pClipDoc->ExtendMerge( aRange, TRUE );
if (bSysClip)
@@ -368,6 +382,12 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi )
ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ if ( ScGlobal::pDrawClipDocShellRef )
+ {
+ SvEmbeddedObjectRef aPersistRef( *ScGlobal::pDrawClipDocShellRef );
+ pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive
+ }
+
pTransferObj->CopyToClipboard( GetActiveWin() ); // system clipboard
SC_MOD()->SetClipObject( pTransferObj, NULL ); // internal clipboard
}
@@ -586,6 +606,9 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
BOOL bCutMode = pClipDoc->IsCutMode(); // if transposing, take from original clipdoc
BOOL bIncludeFiltered = bCutMode;
+ BOOL bPasteDraw = ( pClipDoc->GetDrawLayer() && ( nFlags & IDF_OBJECTS ) );
+
+ ScDocShellRef aTransShellRef; // for objects in pTransClip - must remain valid as long as pTransClip
ScDocument* pOrigClipDoc = NULL;
ScDocument* pTransClip = NULL;
if ( bTranspose )
@@ -601,9 +624,18 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
pOrigClipDoc = pClipDoc; // fuer Referenzen
+ if ( bPasteDraw )
+ {
+ aTransShellRef = new ScDocShell; // DocShell needs a Ref immediately
+ aTransShellRef->DoInitNew(NULL);
+ }
+ ScDrawLayer::SetGlobalDrawPersist(aTransShellRef);
+
pTransClip = new ScDocument( SCDOCMODE_CLIP );
pClipDoc->TransposeClip( pTransClip, nFlags, bAsLink );
pClipDoc = pTransClip;
+
+ ScDrawLayer::SetGlobalDrawPersist(NULL);
}
USHORT nStartCol;
@@ -841,10 +873,11 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
}
+ USHORT nNoObjFlags = nFlags & ~IDF_OBJECTS;
if (!bAsLink)
{
// copy normally (original range)
- pDoc->CopyFromClip( aUserRange, rMark, nFlags, pRefUndoDoc, pClipDoc,
+ pDoc->CopyFromClip( aUserRange, rMark, nNoObjFlags, pRefUndoDoc, pClipDoc,
TRUE, FALSE, bIncludeFiltered );
// bei Transpose Referenzen per Hand anpassen
@@ -854,7 +887,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
else if (!bTranspose)
{
// kopieren mit bAsLink=TRUE
- pDoc->CopyFromClip( aUserRange, rMark, nFlags, pRefUndoDoc, pClipDoc, TRUE, TRUE, bIncludeFiltered );
+ pDoc->CopyFromClip( aUserRange, rMark, nNoObjFlags, pRefUndoDoc, pClipDoc, TRUE, TRUE, bIncludeFiltered );
}
else
{
@@ -875,6 +908,21 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
delete pMixDoc;
+ if ( bPasteDraw )
+ pDocSh->MakeDrawLayer(); // before AdjustBlockHeight, so BeginDrawUndo can be called
+
+ if ( bRecord )
+ pDoc->BeginDrawUndo();
+ AdjustBlockHeight(); // update row heights before pasting objects
+
+ if ( bPasteDraw )
+ {
+ // Paste the drawing objects after the row heights have been updated.
+
+ pDoc->CopyFromClip( aUserRange, rMark, IDF_OBJECTS, pRefUndoDoc, pClipDoc,
+ TRUE, FALSE, bIncludeFiltered );
+ }
+
//
//
//
@@ -950,7 +998,8 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
pDocSh->PostPaint( nStartCol, nStartRow, nStartTab,
nUndoEndCol, nUndoEndRow, nEndTab, nPaint, nExtFlags );
- AdjustBlockHeight(); //! Paint/Undo ?
+ // AdjustBlockHeight has already been called above
+
aModificator.SetDocumentModified();
pDocSh->UpdateOle(GetViewData());