diff options
author | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-28 17:43:26 +0100 |
---|---|---|
committer | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-28 17:43:26 +0100 |
commit | 770837b8b4d2786ff7925d7ad6be69e1d1587ac4 (patch) | |
tree | 4920319e7916388a5f411be3dc50fd4aadcb331c /sc/source/ui/view/viewfun3.cxx | |
parent | 796dfe2205b9a7735e7fb908b3b4fe7d74d76170 (diff) | |
parent | 6f68642b7b2310b902264849a5ffc5dca6c15510 (diff) |
chart46: merge with dev300m98
Diffstat (limited to 'sc/source/ui/view/viewfun3.cxx')
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 3104b7ed8b8f..f7a126c2dac8 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -164,6 +164,9 @@ #include "scitems.hxx" #include <svx/dbexch.hrc> #include <svx/svdetc.hxx> +#include <svx/svditer.hxx> +#include <svx/svdoole2.hxx> +#include <svx/svdpage.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> #include <svl/stritem.hxx> @@ -206,6 +209,10 @@ #include "drwtrans.hxx" #include "docuno.hxx" #include "clipparam.hxx" +#include "drawview.hxx" +#include "chartlis.hxx" +#include "charthelper.hxx" + using namespace com::sun::star; @@ -337,7 +344,28 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI } ScClipParam aClipParam(aRange, bCut); + aClipParam.setSourceDocID( pDoc->GetDocumentID() ); pDoc->CopyToClip(aClipParam, pClipDoc, &rMark, false, false, bIncludeObjects); + + if ( pDoc && pClipDoc ) + { + ScDrawLayer* pDrawLayer = pClipDoc->GetDrawLayer(); + if ( pDrawLayer ) + { + ScClipParam& rClipParam = pClipDoc->GetClipParam(); + ScRangeListVector& rRangesVector = rClipParam.maProtectedChartRangesVector; + SCTAB nTabCount = pClipDoc->GetTableCount(); + for ( SCTAB nTab = 0; nTab < nTabCount; ++nTab ) + { + SdrPage* pPage = pDrawLayer->GetPage( static_cast< sal_uInt16 >( nTab ) ); + if ( pPage ) + { + ScChartHelper::FillProtectedChartRangesVector( rRangesVector, pDoc, pPage ); + } + } + } + } + if (bSysClip) { ScDrawLayer::SetGlobalDrawPersist(NULL); @@ -1350,8 +1378,19 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, AdjustBlockHeight(); // update row heights before pasting objects + ::std::vector< ::rtl::OUString > aExcludedChartNames; + SdrPage* pPage = NULL; + if ( nFlags & IDF_OBJECTS ) { + ScDrawView* pScDrawView = GetScDrawView(); + SdrModel* pModel = ( pScDrawView ? pScDrawView->GetModel() : NULL ); + pPage = ( pModel ? pModel->GetPage( static_cast< sal_uInt16 >( nStartTab ) ) : NULL ); + if ( pPage ) + { + ScChartHelper::GetChartNames( aExcludedChartNames, pPage ); + } + // Paste the drawing objects after the row heights have been updated. pDoc->CopyFromClip( aUserRange, aFilteredMark, IDF_OBJECTS, pRefUndoDoc, pClipDoc, @@ -1450,6 +1489,19 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, aModificator.SetDocumentModified(); PostPasteFromClip(aUserRange, rMark); + + if ( nFlags & IDF_OBJECTS ) + { + ScModelObj* pModelObj = ( pDocSh ? ScModelObj::getImplementation( pDocSh->GetModel() ) : NULL ); + if ( pDoc && pPage && pModelObj ) + { + bool bSameDoc = ( rClipParam.getSourceDocID() == pDoc->GetDocumentID() ); + const ScRangeListVector& rProtectedChartRangesVector( rClipParam.maProtectedChartRangesVector ); + ScChartHelper::CreateProtectedChartListenersAndNotify( pDoc, pPage, pModelObj, nStartTab, + rProtectedChartRangesVector, aExcludedChartNames, bSameDoc ); + } + } + return TRUE; } |