diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-03-10 16:55:21 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-03-10 20:21:13 -0500 |
commit | 12343c15568dcc2c9209d8ca41fda2263122448f (patch) | |
tree | 3212a89c6cd8ea2e0aee7103aa9669bbb8a6f307 /sc/source/ui/view/viewfun7.cxx | |
parent | 99745dbcbb25b61437914c9782475d0b67a4b0bd (diff) | |
parent | ce6308e4fad2281241bf4ca78280eba29f744d43 (diff) |
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
Diffstat (limited to 'sc/source/ui/view/viewfun7.cxx')
-rw-r--r-- | sc/source/ui/view/viewfun7.cxx | 87 |
1 files changed, 58 insertions, 29 deletions
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index 79d36b57e924..9ff8e204fd3b 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -57,12 +57,16 @@ #include "drwlayer.hxx" #include "drwtrans.hxx" #include "globstr.hrc" +#include "chartlis.hxx" +#include "docuno.hxx" +#include "docsh.hxx" +#include "convuno.hxx" extern Point aDragStartDiff; // STATIC DATA ----------------------------------------------------------- -BOOL bPasteIsMove = FALSE; +sal_Bool bPasteIsMove = false; using namespace com::sun::star; @@ -87,7 +91,7 @@ void lcl_AdjustInsertPos( ScViewData* pData, Point& rPos, Size& rSize ) } void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, - BOOL bGroup, BOOL bSameDocClipboard ) + sal_Bool bGroup, sal_Bool bSameDocClipboard ) { MakeDrawLayer(); Point aPos( rLogicPos ); @@ -102,7 +106,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, pRef->SetMapMode( MapMode(MAP_100TH_MM) ); } - BOOL bNegativePage = GetViewData()->GetDocument()->IsNegativePage( GetViewData()->GetTabNo() ); + sal_Bool bNegativePage = GetViewData()->GetDocument()->IsNegativePage( GetViewData()->GetTabNo() ); SdrView* pDragEditView = NULL; ScModule* pScMod = SC_MOD(); @@ -128,7 +132,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, if (bGroup) pScDrawView->BegUndo( ScGlobal::GetRscString( STR_UNDO_PASTE ) ); - BOOL bSameDoc = ( pDragEditView && pDragEditView->GetModel() == pScDrawView->GetModel() ); + sal_Bool bSameDoc = ( pDragEditView && pDragEditView->GetModel() == pScDrawView->GetModel() ); if (bSameDoc) { // lokal kopieren - incl. Charts @@ -144,18 +148,25 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, pDragEditView->GetSdrPageView()->GetPage() ) { if ( nDiffX != 0 || nDiffY != 0 ) - pDragEditView->MoveAllMarked(Size(nDiffX,nDiffY), FALSE); + pDragEditView->MoveAllMarked(Size(nDiffX,nDiffY), false); } else { SdrModel* pDrawModel = pDragEditView->GetModel(); - SdrPage* pDestPage = pDrawModel->GetPage( static_cast<sal_uInt16>(GetViewData()->GetTabNo()) ); + SCTAB nTab = GetViewData()->GetTabNo(); + SdrPage* pDestPage = pDrawModel->GetPage( static_cast< sal_uInt16 >( nTab ) ); DBG_ASSERT(pDestPage,"nanu, Page?"); + ::std::vector< ::rtl::OUString > aExcludedChartNames; + if ( pDestPage ) + { + ScChartHelper::GetChartNames( aExcludedChartNames, pDestPage ); + } + SdrMarkList aMark = pDragEditView->GetMarkedObjectList(); aMark.ForceSort(); - ULONG nMarkAnz=aMark.GetMarkCount(); - for (ULONG nm=0; nm<nMarkAnz; nm++) { + sal_uLong nMarkAnz=aMark.GetMarkCount(); + for (sal_uLong nm=0; nm<nMarkAnz; nm++) { const SdrMark* pM=aMark.GetMark(nm); const SdrObject* pObj=pM->GetMarkedSdrObj(); @@ -182,11 +193,21 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, if (bPasteIsMove) pDragEditView->DeleteMarked(); + + ScDocument* pDocument = GetViewData()->GetDocument(); + ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : NULL ); + if ( pDocument && pDestPage && pModelObj && pDrawTrans ) + { + const ScRangeListVector& rProtectedChartRangesVector( pDrawTrans->GetProtectedChartRangesVector() ); + ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pDestPage, pModelObj, nTab, + rProtectedChartRangesVector, aExcludedChartNames, bSameDoc ); + } } } else { - bPasteIsMove = FALSE; // kein internes Verschieben passiert + bPasteIsMove = false; // kein internes Verschieben passiert SdrView aView(pModel); // #i71529# never create a base class of SdrView directly! SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0)); @@ -197,7 +218,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, // Markierung nicht aendern, wenn Ole-Objekt aktiv // (bei Drop aus Ole-Objekt wuerde sonst mitten im ExecuteDrag deaktiviert!) - ULONG nOptions = 0; + sal_uLong nOptions = 0; SfxInPlaceClient* pClient = GetViewData()->GetViewShell()->GetIPClient(); if ( pClient && pClient->IsObjectInPlaceActive() ) nOptions |= SDRINSERT_DONTMARK; @@ -205,19 +226,15 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, // Set flag for ScDocument::UpdateChartListeners() which is // called during paste. if ( !bSameDocClipboard ) - GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( TRUE ); + GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( sal_True ); pScDrawView->Paste( *pModel, aPos, NULL, nOptions ); if ( !bSameDocClipboard ) - GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( FALSE ); + GetViewData()->GetDocument()->SetPastingDrawFromOtherDoc( false ); // Paste puts all objects on the active (front) layer // controls must be on SC_LAYER_CONTROLS - - SCTAB nTab = GetViewData()->GetTabNo(); - SdrPage* pPage = pScDrawView->GetModel()->GetPage(static_cast<sal_uInt16>(nTab)); - DBG_ASSERT(pPage,"Page?"); if (pPage) { SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); @@ -232,6 +249,18 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, // all graphics objects must have names GetViewData()->GetDocument()->EnsureGraphicNames(); + + ScDocument* pDocument = GetViewData()->GetDocument(); + ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : NULL ); + ScDrawTransferObj* pTransferObj = ScDrawTransferObj::GetOwnClipboard( NULL ); + if ( pDocument && pPage && pModelObj && ( pTransferObj || pDrawTrans ) ) + { + const ScRangeListVector& rProtectedChartRangesVector( + pTransferObj ? pTransferObj->GetProtectedChartRangesVector() : pDrawTrans->GetProtectedChartRangesVector() ); + ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab, + rProtectedChartRangesVector, aExcludedChartNames, bSameDocClipboard ); + } } if (bGroup) @@ -252,7 +281,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, } -BOOL ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::XEmbeddedObject >& xObj, +sal_Bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::XEmbeddedObject >& xObj, const Size* pDescSize, const Graphic* pReplGraph, const ::rtl::OUString& aMediaType, sal_Int64 nAspect ) { MakeDrawLayer(); @@ -328,28 +357,28 @@ BOOL ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X SdrPageView* pPV = pDrView->GetSdrPageView(); pDrView->InsertObjectSafe( pSdrObj, *pPV ); // nicht markieren wenn Ole - GetViewData()->GetViewShell()->SetDrawShell( TRUE ); - return TRUE; + GetViewData()->GetViewShell()->SetDrawShell( sal_True ); + return sal_True; } else - return FALSE; + return false; } -BOOL ScViewFunc::PasteBitmap( const Point& rPos, const Bitmap& rBmp ) +sal_Bool ScViewFunc::PasteBitmap( const Point& rPos, const Bitmap& rBmp ) { String aEmpty; Graphic aGraphic(rBmp); return PasteGraphic( rPos, aGraphic, aEmpty, aEmpty ); } -BOOL ScViewFunc::PasteMetaFile( const Point& rPos, const GDIMetaFile& rMtf ) +sal_Bool ScViewFunc::PasteMetaFile( const Point& rPos, const GDIMetaFile& rMtf ) { String aEmpty; Graphic aGraphic(rMtf); return PasteGraphic( rPos, aGraphic, aEmpty, aEmpty ); } -BOOL ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic, +sal_Bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic, const String& rFile, const String& rFilter ) { MakeDrawLayer(); @@ -375,7 +404,7 @@ BOOL ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic, if ( GetViewData()->GetDocument()->IsNegativePage( GetViewData()->GetTabNo() ) ) aPos.X() -= aSize.Width(); - GetViewData()->GetViewShell()->SetDrawShell( TRUE ); + GetViewData()->GetViewShell()->SetDrawShell( sal_True ); Rectangle aRect(aPos, aSize); SdrGrafObj* pGrafObj = new SdrGrafObj(rGraphic, aRect); @@ -397,12 +426,12 @@ BOOL ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic, if (rFile.Len()) pGrafObj->SetGraphicLink( rFile, rFilter ); - return TRUE; + return sal_True; } -BOOL ScViewFunc::ApplyGraphicToObject( SdrObject* pPickObj, const Graphic& rGraphic ) +sal_Bool ScViewFunc::ApplyGraphicToObject( SdrObject* pPickObj, const Graphic& rGraphic ) { - BOOL bRet = FALSE; + sal_Bool bRet = false; SdrGrafObj* pNewGrafObj = NULL; ScDrawView* pScDrawView = GetScDrawView(); @@ -424,7 +453,7 @@ BOOL ScViewFunc::ApplyGraphicToObject( SdrObject* pPickObj, const Graphic& rGrap pScDrawView->ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); pScDrawView->EndUndo(); - bRet = TRUE; + bRet = sal_True; } else if (pPickObj->IsClosedObj() && !pPickObj->ISA(SdrOle2Obj)) { @@ -443,7 +472,7 @@ BOOL ScViewFunc::ApplyGraphicToObject( SdrObject* pPickObj, const Graphic& rGrap pPickObj->SetMergedItemSetAndBroadcast(aSet); - bRet = TRUE; + bRet = sal_True; } } return bRet; |