1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10*5b190011SAndrew Rist * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*5b190011SAndrew Rist * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19*5b190011SAndrew Rist * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "View.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <vector> 31cdf0e10cSrcweir #include <com/sun/star/embed/XEmbedPersist.hpp> 32cdf0e10cSrcweir #include <tools/ref.hxx> 33cdf0e10cSrcweir #include <tools/urlobj.hxx> 34cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen 35cdf0e10cSrcweir #include <vcl/msgbox.hxx> 36cdf0e10cSrcweir #endif 37cdf0e10cSrcweir #include <svx/svdetc.hxx> 38cdf0e10cSrcweir #include <svx/svdoole2.hxx> 39cdf0e10cSrcweir #include <svx/svdograf.hxx> 40cdf0e10cSrcweir #include <vcl/graph.hxx> 41cdf0e10cSrcweir #include <svx/xexch.hxx> 42cdf0e10cSrcweir #include <svx/svxdlg.hxx> 43cdf0e10cSrcweir #include <svx/dialogs.hrc> 44cdf0e10cSrcweir #include <sfx2/docfile.hxx> 45cdf0e10cSrcweir #include <sfx2/childwin.hxx> 46cdf0e10cSrcweir #include <svx/svdundo.hxx> 47cdf0e10cSrcweir #include <svx/svdpagv.hxx> 48cdf0e10cSrcweir #include <svl/urlbmk.hxx> 49cdf0e10cSrcweir #include <svl/urlbmk.hxx> 50cdf0e10cSrcweir #include <editeng/outliner.hxx> 51cdf0e10cSrcweir #include <svx/xflclit.hxx> 52cdf0e10cSrcweir #include <svx/dbexch.hrc> 53cdf0e10cSrcweir #include <sot/formats.hxx> 54cdf0e10cSrcweir #include <editeng/editeng.hxx> 55cdf0e10cSrcweir #include <svx/svditer.hxx> 56cdf0e10cSrcweir #include <svx/obj3d.hxx> 57cdf0e10cSrcweir #include <svx/scene3d.hxx> 58cdf0e10cSrcweir 59cdf0e10cSrcweir #include <sfx2/objsh.hxx> 60cdf0e10cSrcweir #include <svtools/embedtransfer.hxx> 61cdf0e10cSrcweir 62cdf0e10cSrcweir #include "navigatr.hxx" 63cdf0e10cSrcweir #include "anminfo.hxx" 64cdf0e10cSrcweir #include "strings.hrc" 65cdf0e10cSrcweir #include "glob.hrc" 66cdf0e10cSrcweir #include "sdxfer.hxx" 67cdf0e10cSrcweir #include "sdresid.hxx" 68cdf0e10cSrcweir #include "sdmod.hxx" 69cdf0e10cSrcweir #include "DrawViewShell.hxx" 70cdf0e10cSrcweir #include "DrawDocShell.hxx" 71cdf0e10cSrcweir #include "fudraw.hxx" 72cdf0e10cSrcweir #include "drawdoc.hxx" 73cdf0e10cSrcweir #include "Window.hxx" 74cdf0e10cSrcweir #include "sdpage.hxx" 75cdf0e10cSrcweir #include "unoaprms.hxx" 76cdf0e10cSrcweir #include "drawview.hxx" 77cdf0e10cSrcweir #include "helpids.h" 78cdf0e10cSrcweir #include <vcl/svapp.hxx> 79cdf0e10cSrcweir 80cdf0e10cSrcweir #include "slideshow.hxx" 81cdf0e10cSrcweir 82cdf0e10cSrcweir namespace sd { 83cdf0e10cSrcweir 84cdf0e10cSrcweir #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED 85cdf0e10cSrcweir #define SO2_DECL_SVINPLACEOBJECT_DEFINED 86cdf0e10cSrcweir SO2_DECL_REF(SvInPlaceObject) 87cdf0e10cSrcweir #endif 88cdf0e10cSrcweir #ifndef SO2_DECL_SVSTORAGE_DEFINED 89cdf0e10cSrcweir #define SO2_DECL_SVSTORAGE_DEFINED 90cdf0e10cSrcweir SO2_DECL_REF(SvStorage) 91cdf0e10cSrcweir #endif 92cdf0e10cSrcweir 93cdf0e10cSrcweir using namespace ::com::sun::star; 94cdf0e10cSrcweir 95cdf0e10cSrcweir // ------------------------ 96cdf0e10cSrcweir // - SdNavigatorDropEvent - 97cdf0e10cSrcweir // ------------------------ 98cdf0e10cSrcweir 99cdf0e10cSrcweir struct SdNavigatorDropEvent : public ExecuteDropEvent 100cdf0e10cSrcweir { 101cdf0e10cSrcweir DropTargetHelper& mrTargetHelper; 102cdf0e10cSrcweir ::sd::Window* mpTargetWindow; 103cdf0e10cSrcweir sal_uInt16 mnPage; 104cdf0e10cSrcweir sal_uInt16 mnLayer; 105cdf0e10cSrcweir 106cdf0e10cSrcweir SdNavigatorDropEvent ( 107cdf0e10cSrcweir const ExecuteDropEvent& rEvt, 108cdf0e10cSrcweir DropTargetHelper& rTargetHelper, 109cdf0e10cSrcweir ::sd::Window* pTargetWindow, 110cdf0e10cSrcweir sal_uInt16 nPage, 111cdf0e10cSrcweir sal_uInt16 nLayer ) 112cdf0e10cSrcweir : ExecuteDropEvent( rEvt ), 113cdf0e10cSrcweir mrTargetHelper( rTargetHelper ), 114cdf0e10cSrcweir mpTargetWindow( pTargetWindow ), 115cdf0e10cSrcweir mnPage( nPage ), 116cdf0e10cSrcweir mnLayer( nLayer ) 117cdf0e10cSrcweir {} 118cdf0e10cSrcweir }; 119cdf0e10cSrcweir 120cdf0e10cSrcweir // ----------------------------------------------------------------------------- 121cdf0e10cSrcweir 122cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > View::CreateClipboardDataObject( View*, ::Window& ) 123cdf0e10cSrcweir { 124cdf0e10cSrcweir // since SdTransferable::CopyToClipboard is called, this 125cdf0e10cSrcweir // dynamically created object ist destroyed automatically 126cdf0e10cSrcweir SdTransferable* pTransferable = new SdTransferable( mpDoc, NULL, sal_False ); 127cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xRet( pTransferable ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir SD_MOD()->pTransferClip = pTransferable; 130cdf0e10cSrcweir 131cdf0e10cSrcweir mpDoc->CreatingDataObj( pTransferable ); 132cdf0e10cSrcweir pTransferable->SetWorkDocument( (SdDrawDocument*) GetAllMarkedModel() ); 133cdf0e10cSrcweir mpDoc->CreatingDataObj( NULL ); 134cdf0e10cSrcweir 135cdf0e10cSrcweir // #112978# need to use GetAllMarkedBoundRect instead of GetAllMarkedRect to get 136cdf0e10cSrcweir // fat lines correctly 137cdf0e10cSrcweir const Rectangle aMarkRect( GetAllMarkedBoundRect() ); 138cdf0e10cSrcweir TransferableObjectDescriptor aObjDesc; 139cdf0e10cSrcweir String aDisplayName; 140cdf0e10cSrcweir SdrOle2Obj* pSdrOleObj = NULL; 141cdf0e10cSrcweir SdrPageView* pPgView = GetSdrPageView(); 142cdf0e10cSrcweir SdPage* pOldPage = pPgView ? ( (SdPage*) pPgView->GetPage() ) : NULL; 143cdf0e10cSrcweir SdPage* pNewPage = (SdPage*) pTransferable->GetWorkDocument()->GetPage( 0 ); 144cdf0e10cSrcweir 145cdf0e10cSrcweir if( pOldPage ) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir pNewPage->SetSize( pOldPage->GetSize() ); 148cdf0e10cSrcweir pNewPage->SetLayoutName( pOldPage->GetLayoutName() ); 149cdf0e10cSrcweir } 150cdf0e10cSrcweir 151cdf0e10cSrcweir if( GetMarkedObjectCount() == 1 ) 152cdf0e10cSrcweir { 153cdf0e10cSrcweir SdrObject* pObj = GetMarkedObjectByIndex(0); 154cdf0e10cSrcweir 155cdf0e10cSrcweir if( pObj && pObj->ISA(SdrOle2Obj) && ((SdrOle2Obj*) pObj)->GetObjRef().is() ) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir // If object has no persistence it must be copied as part of the document 158cdf0e10cSrcweir try 159cdf0e10cSrcweir { 160cdf0e10cSrcweir uno::Reference< embed::XEmbedPersist > xPersObj( ((SdrOle2Obj*)pObj)->GetObjRef(), uno::UNO_QUERY ); 161cdf0e10cSrcweir if ( xPersObj.is() && xPersObj->hasEntry() ) 162cdf0e10cSrcweir pSdrOleObj = (SdrOle2Obj*) pObj; 163cdf0e10cSrcweir } 164cdf0e10cSrcweir catch( uno::Exception& ) 165cdf0e10cSrcweir {} 166cdf0e10cSrcweir } 167cdf0e10cSrcweir } 168cdf0e10cSrcweir 169cdf0e10cSrcweir if( pSdrOleObj ) 170cdf0e10cSrcweir SvEmbedTransferHelper::FillTransferableObjectDescriptor( aObjDesc, pSdrOleObj->GetObjRef(), pSdrOleObj->GetGraphic(), pSdrOleObj->GetAspect() ); 171cdf0e10cSrcweir else 172cdf0e10cSrcweir pTransferable->GetWorkDocument()->GetDocSh()->FillTransferableObjectDescriptor( aObjDesc ); 173cdf0e10cSrcweir 174cdf0e10cSrcweir if( mpDocSh ) 175cdf0e10cSrcweir aObjDesc.maDisplayName = mpDocSh->GetMedium()->GetURLObject().GetURLNoPass(); 176cdf0e10cSrcweir 177cdf0e10cSrcweir aObjDesc.maSize = aMarkRect.GetSize(); 178cdf0e10cSrcweir 179cdf0e10cSrcweir pTransferable->SetStartPos( aMarkRect.TopLeft() ); 180cdf0e10cSrcweir pTransferable->SetObjectDescriptor( aObjDesc ); 181cdf0e10cSrcweir pTransferable->CopyToClipboard( mpViewSh->GetActiveWindow() ); 182cdf0e10cSrcweir 183cdf0e10cSrcweir return xRet; 184cdf0e10cSrcweir } 185cdf0e10cSrcweir 186cdf0e10cSrcweir // ----------------------------------------------------------------------------- 187cdf0e10cSrcweir 188cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > View::CreateDragDataObject( View* pWorkView, ::Window& rWindow, const Point& rDragPos ) 189cdf0e10cSrcweir { 190cdf0e10cSrcweir SdTransferable* pTransferable = new SdTransferable( mpDoc, pWorkView, sal_False ); 191cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xRet( pTransferable ); 192cdf0e10cSrcweir 193cdf0e10cSrcweir SD_MOD()->pTransferDrag = pTransferable; 194cdf0e10cSrcweir 195cdf0e10cSrcweir TransferableObjectDescriptor aObjDesc; 196cdf0e10cSrcweir String aDisplayName; 197cdf0e10cSrcweir SdrOle2Obj* pSdrOleObj = NULL; 198cdf0e10cSrcweir 199cdf0e10cSrcweir if( GetMarkedObjectCount() == 1 ) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir SdrObject* pObj = GetMarkedObjectByIndex( 0 ); 202cdf0e10cSrcweir 203cdf0e10cSrcweir if( pObj && pObj->ISA( SdrOle2Obj ) && ( (SdrOle2Obj*) pObj )->GetObjRef().is() ) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir // If object has no persistence it must be copied as part of the document 206cdf0e10cSrcweir try 207cdf0e10cSrcweir { 208cdf0e10cSrcweir uno::Reference< embed::XEmbedPersist > xPersObj( ((SdrOle2Obj*)pObj)->GetObjRef(), uno::UNO_QUERY ); 209cdf0e10cSrcweir if ( xPersObj.is() && xPersObj->hasEntry() ) 210cdf0e10cSrcweir pSdrOleObj = (SdrOle2Obj*) pObj; 211cdf0e10cSrcweir } 212cdf0e10cSrcweir catch( uno::Exception& ) 213cdf0e10cSrcweir {} 214cdf0e10cSrcweir } 215cdf0e10cSrcweir } 216cdf0e10cSrcweir 217cdf0e10cSrcweir if( mpDocSh ) 218cdf0e10cSrcweir aDisplayName = mpDocSh->GetMedium()->GetURLObject().GetURLNoPass(); 219cdf0e10cSrcweir 220cdf0e10cSrcweir if( pSdrOleObj ) 221cdf0e10cSrcweir SvEmbedTransferHelper::FillTransferableObjectDescriptor( aObjDesc, pSdrOleObj->GetObjRef(), pSdrOleObj->GetGraphic(), pSdrOleObj->GetAspect() ); 222cdf0e10cSrcweir else 223cdf0e10cSrcweir mpDocSh->FillTransferableObjectDescriptor( aObjDesc ); 224cdf0e10cSrcweir 225cdf0e10cSrcweir aObjDesc.maSize = GetAllMarkedRect().GetSize(); 226cdf0e10cSrcweir aObjDesc.maDragStartPos = rDragPos; 227cdf0e10cSrcweir aObjDesc.maDisplayName = aDisplayName; 228cdf0e10cSrcweir aObjDesc.mbCanLink = sal_False; 229cdf0e10cSrcweir 230cdf0e10cSrcweir pTransferable->SetStartPos( rDragPos ); 231cdf0e10cSrcweir pTransferable->SetObjectDescriptor( aObjDesc ); 232cdf0e10cSrcweir pTransferable->StartDrag( &rWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); 233cdf0e10cSrcweir 234cdf0e10cSrcweir return xRet; 235cdf0e10cSrcweir } 236cdf0e10cSrcweir 237cdf0e10cSrcweir // ----------------------------------------------------------------------------- 238cdf0e10cSrcweir 239cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > View::CreateSelectionDataObject( View* pWorkView, ::Window& rWindow ) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir SdTransferable* pTransferable = new SdTransferable( mpDoc, pWorkView, sal_True ); 242cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xRet( pTransferable ); 243cdf0e10cSrcweir TransferableObjectDescriptor aObjDesc; 244cdf0e10cSrcweir const Rectangle aMarkRect( GetAllMarkedRect() ); 245cdf0e10cSrcweir String aDisplayName; 246cdf0e10cSrcweir 247cdf0e10cSrcweir SD_MOD()->pTransferSelection = pTransferable; 248cdf0e10cSrcweir 249cdf0e10cSrcweir if( mpDocSh ) 250cdf0e10cSrcweir { 251cdf0e10cSrcweir aDisplayName = mpDocSh->GetMedium()->GetURLObject().GetURLNoPass(); 252cdf0e10cSrcweir mpDocSh->FillTransferableObjectDescriptor( aObjDesc ); 253cdf0e10cSrcweir } 254cdf0e10cSrcweir 255cdf0e10cSrcweir aObjDesc.maSize = aMarkRect.GetSize(); 256cdf0e10cSrcweir 257cdf0e10cSrcweir pTransferable->SetStartPos( aMarkRect.TopLeft() ); 258cdf0e10cSrcweir pTransferable->SetObjectDescriptor( aObjDesc ); 259cdf0e10cSrcweir pTransferable->CopyToSelection( &rWindow ); 260cdf0e10cSrcweir 261cdf0e10cSrcweir return xRet; 262cdf0e10cSrcweir } 263cdf0e10cSrcweir 264cdf0e10cSrcweir // ----------------------------------------------------------------------------- 265cdf0e10cSrcweir 266cdf0e10cSrcweir void View::UpdateSelectionClipboard( sal_Bool bForceDeselect ) 267cdf0e10cSrcweir { 268cdf0e10cSrcweir if( mpViewSh && mpViewSh->GetActiveWindow() ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir if( !bForceDeselect && GetMarkedObjectList().GetMarkCount() ) 271cdf0e10cSrcweir CreateSelectionDataObject( this, *mpViewSh->GetActiveWindow() ); 272cdf0e10cSrcweir else if( SD_MOD()->pTransferSelection && ( SD_MOD()->pTransferSelection->GetView() == this ) ) 273cdf0e10cSrcweir { 274cdf0e10cSrcweir TransferableHelper::ClearSelection( mpViewSh->GetActiveWindow() ); 275cdf0e10cSrcweir SD_MOD()->pTransferSelection = NULL; 276cdf0e10cSrcweir } 277cdf0e10cSrcweir } 278cdf0e10cSrcweir } 279cdf0e10cSrcweir 280cdf0e10cSrcweir // ----------------------------------------------------------------------------- 281cdf0e10cSrcweir 282cdf0e10cSrcweir void View::DoCut(::Window* ) 283cdf0e10cSrcweir { 284cdf0e10cSrcweir const OutlinerView* pOLV = GetTextEditOutlinerView(); 285cdf0e10cSrcweir 286cdf0e10cSrcweir if( pOLV ) 287cdf0e10cSrcweir ( (OutlinerView*) pOLV)->Cut(); 288cdf0e10cSrcweir else if( AreObjectsMarked() ) 289cdf0e10cSrcweir { 290cdf0e10cSrcweir String aStr( SdResId(STR_UNDO_CUT) ); 291cdf0e10cSrcweir 292cdf0e10cSrcweir DoCopy(); 293cdf0e10cSrcweir BegUndo( ( aStr += sal_Unicode(' ') ) += GetDescriptionOfMarkedObjects() ); 294cdf0e10cSrcweir DeleteMarked(); 295cdf0e10cSrcweir EndUndo(); 296cdf0e10cSrcweir } 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir // ----------------------------------------------------------------------------- 300cdf0e10cSrcweir 301cdf0e10cSrcweir void View::DoCopy (::Window* pWindow) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir const OutlinerView* pOLV = GetTextEditOutlinerView(); 304cdf0e10cSrcweir 305cdf0e10cSrcweir if( pOLV ) 306cdf0e10cSrcweir ( (OutlinerView*) pOLV)->Copy(); 307cdf0e10cSrcweir else if( AreObjectsMarked() ) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir BrkAction(); 310cdf0e10cSrcweir CreateClipboardDataObject( this, *pWindow ); 311cdf0e10cSrcweir } 312cdf0e10cSrcweir } 313cdf0e10cSrcweir 314cdf0e10cSrcweir // ----------------------------------------------------------------------------- 315cdf0e10cSrcweir 316cdf0e10cSrcweir void View::DoPaste (::Window* pWindow) 317cdf0e10cSrcweir { 318cdf0e10cSrcweir TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mpViewSh->GetActiveWindow() ) ); 319cdf0e10cSrcweir if( !aDataHelper.GetTransferable().is() ) 320cdf0e10cSrcweir return; // empty clipboard? 321cdf0e10cSrcweir 322cdf0e10cSrcweir const OutlinerView* pOLV = GetTextEditOutlinerView(); 323cdf0e10cSrcweir 324cdf0e10cSrcweir if( pOLV && EditEngine::HasValidData( aDataHelper.GetTransferable() ) ) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir const_cast< OutlinerView* >(pOLV)->PasteSpecial(); 327cdf0e10cSrcweir 328cdf0e10cSrcweir SdrObject* pObj = GetTextEditObject(); 329cdf0e10cSrcweir SdPage* pPage = (SdPage*)( pObj ? pObj->GetPage() : NULL ); 330cdf0e10cSrcweir ::Outliner* pOutliner = pOLV->GetOutliner(); 331cdf0e10cSrcweir 332cdf0e10cSrcweir if( pOutliner) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir if( pObj && pPage && pPage->GetPresObjKind(pObj) == PRESOBJ_TITLE ) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir // remove all hard linebreaks from the title 337cdf0e10cSrcweir if( pOutliner && pOutliner->GetParagraphCount() > 1 ) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir sal_Bool bOldUpdateMode = pOutliner->GetUpdateMode(); 340cdf0e10cSrcweir 341cdf0e10cSrcweir pOutliner->SetUpdateMode( sal_False ); 342cdf0e10cSrcweir 343cdf0e10cSrcweir const EditEngine& rEdit = pOutliner->GetEditEngine(); 344cdf0e10cSrcweir const int nParaCount = rEdit.GetParagraphCount(); 345cdf0e10cSrcweir 346cdf0e10cSrcweir for( int nPara = nParaCount - 2; nPara >= 0; nPara-- ) 347cdf0e10cSrcweir { 348cdf0e10cSrcweir const sal_uInt16 nParaLen = (sal_uInt16)rEdit.GetTextLen( (sal_uInt16)nPara ); 349cdf0e10cSrcweir pOutliner->QuickDelete( ESelection( (sal_uInt16)nPara, nParaLen, (sal_uInt16)nPara+1, 0 ) ); 350cdf0e10cSrcweir pOutliner->QuickInsertLineBreak( ESelection( (sal_uInt16)nPara, nParaLen, (sal_uInt16)nPara, nParaLen ) ); 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir DBG_ASSERT( rEdit.GetParagraphCount() <= 1, "Titelobjekt contains hard line breaks" ); 354cdf0e10cSrcweir pOutliner->SetUpdateMode(bOldUpdateMode); 355cdf0e10cSrcweir } 356cdf0e10cSrcweir } 357cdf0e10cSrcweir 358cdf0e10cSrcweir if( !mpDoc->IsChanged() ) 359cdf0e10cSrcweir { 360cdf0e10cSrcweir if( pOutliner && pOutliner->IsModified() ) 361cdf0e10cSrcweir mpDoc->SetChanged( sal_True ); 362cdf0e10cSrcweir } 363cdf0e10cSrcweir } 364cdf0e10cSrcweir } 365cdf0e10cSrcweir else 366cdf0e10cSrcweir { 367cdf0e10cSrcweir Point aPos; 368cdf0e10cSrcweir sal_Int8 nDnDAction = DND_ACTION_COPY; 369cdf0e10cSrcweir 370cdf0e10cSrcweir if( pWindow ) 371cdf0e10cSrcweir aPos = pWindow->PixelToLogic( Rectangle( aPos, pWindow->GetOutputSizePixel() ).Center() ); 372cdf0e10cSrcweir 373cdf0e10cSrcweir DrawViewShell* pDrViewSh = (DrawViewShell*) mpDocSh->GetViewShell(); 374cdf0e10cSrcweir 375cdf0e10cSrcweir if (pDrViewSh != NULL) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir if( !InsertData( aDataHelper, aPos, nDnDAction, sal_False ) ) 378cdf0e10cSrcweir { 379cdf0e10cSrcweir INetBookmark aINetBookmark( aEmptyStr, aEmptyStr ); 380cdf0e10cSrcweir 381cdf0e10cSrcweir if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) && 382cdf0e10cSrcweir aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) || 383cdf0e10cSrcweir ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) && 384cdf0e10cSrcweir aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) || 385cdf0e10cSrcweir ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) && 386cdf0e10cSrcweir aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) ) 387cdf0e10cSrcweir { 388cdf0e10cSrcweir pDrViewSh->InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL ); 389cdf0e10cSrcweir } 390cdf0e10cSrcweir } 391cdf0e10cSrcweir } 392cdf0e10cSrcweir } 393cdf0e10cSrcweir } 394cdf0e10cSrcweir 395cdf0e10cSrcweir // ----------------------------------------------------------------------------- 396cdf0e10cSrcweir 397cdf0e10cSrcweir void View::StartDrag( const Point& rStartPos, ::Window* pWindow ) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir if( AreObjectsMarked() && IsAction() && mpViewSh && pWindow && !mpDragSrcMarkList ) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir BrkAction(); 402cdf0e10cSrcweir 403cdf0e10cSrcweir if( IsTextEdit() ) 404cdf0e10cSrcweir SdrEndTextEdit(); 405cdf0e10cSrcweir 406cdf0e10cSrcweir DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpDocSh ? mpDocSh->GetViewShell() : 0 ); 407cdf0e10cSrcweir 408cdf0e10cSrcweir if( pDrawViewShell ) 409cdf0e10cSrcweir { 410cdf0e10cSrcweir FunctionReference xFunction( pDrawViewShell->GetCurrentFunction() ); 411cdf0e10cSrcweir 412cdf0e10cSrcweir if( xFunction.is() && xFunction->ISA( FuDraw ) ) 413cdf0e10cSrcweir static_cast<FuDraw*>(xFunction.get())->ForcePointer( NULL ); 414cdf0e10cSrcweir } 415cdf0e10cSrcweir 416cdf0e10cSrcweir mpDragSrcMarkList = new SdrMarkList(GetMarkedObjectList()); 417cdf0e10cSrcweir mnDragSrcPgNum = GetSdrPageView()->GetPage()->GetPageNum(); 418cdf0e10cSrcweir 419cdf0e10cSrcweir if( IsUndoEnabled() ) 420cdf0e10cSrcweir { 421cdf0e10cSrcweir String aStr( SdResId(STR_UNDO_DRAGDROP) ); 422cdf0e10cSrcweir aStr += sal_Unicode(' '); 423cdf0e10cSrcweir aStr += mpDragSrcMarkList->GetMarkDescription(); 424cdf0e10cSrcweir BegUndo(aStr); 425cdf0e10cSrcweir } 426cdf0e10cSrcweir CreateDragDataObject( this, *pWindow, rStartPos ); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir } 429cdf0e10cSrcweir 430cdf0e10cSrcweir // ----------------------------------------------------------------------------- 431cdf0e10cSrcweir 432cdf0e10cSrcweir void View::DragFinished( sal_Int8 nDropAction ) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir const bool bUndo = IsUndoEnabled(); 435cdf0e10cSrcweir 436cdf0e10cSrcweir SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; 437cdf0e10cSrcweir 438cdf0e10cSrcweir if( pDragTransferable ) 439cdf0e10cSrcweir pDragTransferable->SetView( NULL ); 440cdf0e10cSrcweir 441cdf0e10cSrcweir if( ( nDropAction & DND_ACTION_MOVE ) && 442cdf0e10cSrcweir pDragTransferable && !pDragTransferable->IsInternalMove() && 443cdf0e10cSrcweir mpDragSrcMarkList && mpDragSrcMarkList->GetMarkCount() && 444cdf0e10cSrcweir !IsPresObjSelected() ) 445cdf0e10cSrcweir { 446cdf0e10cSrcweir mpDragSrcMarkList->ForceSort(); 447cdf0e10cSrcweir 448cdf0e10cSrcweir if( bUndo ) 449cdf0e10cSrcweir BegUndo(); 450cdf0e10cSrcweir 451cdf0e10cSrcweir sal_uLong nm, nAnz = mpDragSrcMarkList->GetMarkCount(); 452cdf0e10cSrcweir 453cdf0e10cSrcweir for( nm = nAnz; nm>0; ) 454cdf0e10cSrcweir { 455cdf0e10cSrcweir nm--; 456cdf0e10cSrcweir SdrMark* pM=mpDragSrcMarkList->GetMark(nm); 457cdf0e10cSrcweir if( bUndo ) 458cdf0e10cSrcweir AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pM->GetMarkedSdrObj())); 459cdf0e10cSrcweir } 460cdf0e10cSrcweir 461cdf0e10cSrcweir mpDragSrcMarkList->GetMark(0)->GetMarkedSdrObj()->GetOrdNum(); 462cdf0e10cSrcweir 463cdf0e10cSrcweir for (nm=nAnz; nm>0;) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir nm--; 466cdf0e10cSrcweir SdrMark* pM=mpDragSrcMarkList->GetMark(nm); 467cdf0e10cSrcweir SdrObject* pObj=pM->GetMarkedSdrObj(); 468cdf0e10cSrcweir sal_uInt32 nOrdNum=pObj->GetOrdNumDirect(); 469cdf0e10cSrcweir 470cdf0e10cSrcweir if( pObj && pObj->GetPage() ) 471cdf0e10cSrcweir { 472cdf0e10cSrcweir #ifdef DBG_UTIL 473cdf0e10cSrcweir SdrObject* pChkObj = 474cdf0e10cSrcweir #endif 475cdf0e10cSrcweir pObj->GetPage()->RemoveObject(nOrdNum); 476cdf0e10cSrcweir DBG_ASSERT(pChkObj==pObj,"pChkObj!=pObj beim RemoveObject()"); 477cdf0e10cSrcweir } 478cdf0e10cSrcweir } 479cdf0e10cSrcweir 480cdf0e10cSrcweir if( bUndo ) 481cdf0e10cSrcweir EndUndo(); 482cdf0e10cSrcweir } 483cdf0e10cSrcweir 484cdf0e10cSrcweir if( pDragTransferable ) 485cdf0e10cSrcweir pDragTransferable->SetInternalMove( sal_False ); 486cdf0e10cSrcweir 487cdf0e10cSrcweir if( bUndo ) 488cdf0e10cSrcweir EndUndo(); 489cdf0e10cSrcweir mnDragSrcPgNum = SDRPAGE_NOTFOUND; 490cdf0e10cSrcweir delete mpDragSrcMarkList; 491cdf0e10cSrcweir mpDragSrcMarkList = NULL; 492cdf0e10cSrcweir } 493cdf0e10cSrcweir 494cdf0e10cSrcweir // ----------------------------------------------------------------------------- 495cdf0e10cSrcweir 496cdf0e10cSrcweir sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper, 497cdf0e10cSrcweir ::sd::Window*, sal_uInt16, sal_uInt16 nLayer ) 498cdf0e10cSrcweir { 499cdf0e10cSrcweir String aLayerName( GetActiveLayer() ); 500cdf0e10cSrcweir SdrPageView* pPV = GetSdrPageView(); 501cdf0e10cSrcweir sal_Int8 nDropAction = rEvt.mnAction; 502cdf0e10cSrcweir sal_Int8 nRet = DND_ACTION_NONE; 503cdf0e10cSrcweir 504cdf0e10cSrcweir if( nLayer != SDRLAYER_NOTFOUND ) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin(); 507cdf0e10cSrcweir aLayerName = rLayerAdmin.GetLayerPerID(nLayer)->GetName(); 508cdf0e10cSrcweir } 509cdf0e10cSrcweir 510cdf0e10cSrcweir if( mbIsDropAllowed && !pPV->IsLayerLocked( aLayerName ) && pPV->IsLayerVisible( aLayerName ) ) 511cdf0e10cSrcweir { 512cdf0e10cSrcweir const OutlinerView* pOLV = GetTextEditOutlinerView(); 513cdf0e10cSrcweir sal_Bool bIsInsideOutlinerView = sal_False; 514cdf0e10cSrcweir 515cdf0e10cSrcweir if( pOLV ) 516cdf0e10cSrcweir { 517cdf0e10cSrcweir Rectangle aRect( pOLV->GetOutputArea() ); 518cdf0e10cSrcweir 519cdf0e10cSrcweir if (GetMarkedObjectCount() == 1) 520cdf0e10cSrcweir { 521cdf0e10cSrcweir SdrMark* pMark = GetSdrMarkByIndex(0); 522cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 523cdf0e10cSrcweir aRect.Union( pObj->GetLogicRect() ); 524cdf0e10cSrcweir } 525cdf0e10cSrcweir 526cdf0e10cSrcweir if( aRect.IsInside( pOLV->GetWindow()->PixelToLogic( rEvt.maPosPixel ) ) ) 527cdf0e10cSrcweir { 528cdf0e10cSrcweir bIsInsideOutlinerView = sal_True; 529cdf0e10cSrcweir } 530cdf0e10cSrcweir } 531cdf0e10cSrcweir 532cdf0e10cSrcweir if( !bIsInsideOutlinerView ) 533cdf0e10cSrcweir { 534cdf0e10cSrcweir SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; 535cdf0e10cSrcweir 536cdf0e10cSrcweir if( pDragTransferable ) 537cdf0e10cSrcweir { 538cdf0e10cSrcweir const View* pSourceView = pDragTransferable->GetView(); 539cdf0e10cSrcweir 540cdf0e10cSrcweir if( pDragTransferable->IsPageTransferable() ) 541cdf0e10cSrcweir { 542cdf0e10cSrcweir nRet = DND_ACTION_COPY; 543cdf0e10cSrcweir } 544cdf0e10cSrcweir else if( pSourceView ) 545cdf0e10cSrcweir { 546cdf0e10cSrcweir if( !( nDropAction & DND_ACTION_LINK ) || 547cdf0e10cSrcweir pSourceView->GetDocSh()->GetMedium()->GetName().Len() ) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir nRet = nDropAction; 550cdf0e10cSrcweir } 551cdf0e10cSrcweir } 552cdf0e10cSrcweir } 553cdf0e10cSrcweir else 554cdf0e10cSrcweir { 555cdf0e10cSrcweir const sal_Bool bDrawing = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_DRAWING ); 556cdf0e10cSrcweir const sal_Bool bGraphic = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_SVXB ); 557cdf0e10cSrcweir const sal_Bool bMtf = rTargetHelper.IsDropFormatSupported( FORMAT_GDIMETAFILE ); 558cdf0e10cSrcweir const sal_Bool bBitmap = rTargetHelper.IsDropFormatSupported( FORMAT_BITMAP ); 559cdf0e10cSrcweir sal_Bool bBookmark = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ); 560cdf0e10cSrcweir sal_Bool bXFillExchange = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_XFA ); 561cdf0e10cSrcweir 562cdf0e10cSrcweir // check handle insert 563cdf0e10cSrcweir if( !nRet && ( (bXFillExchange && ( SDRDRAG_GRADIENT == GetDragMode() )) || ( SDRDRAG_TRANSPARENCE == GetDragMode() ) ) ) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir const SdrHdlList& rHdlList = GetHdlList(); 566cdf0e10cSrcweir 567cdf0e10cSrcweir for( sal_uInt32 n = 0; n < rHdlList.GetHdlCount(); n++ ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir SdrHdl* pIAOHandle = rHdlList.GetHdl( n ); 570cdf0e10cSrcweir 571cdf0e10cSrcweir if( pIAOHandle && ( HDL_COLR == pIAOHandle->GetKind() ) ) 572cdf0e10cSrcweir { 573cdf0e10cSrcweir if(pIAOHandle->getOverlayObjectList().isHitPixel(rEvt.maPosPixel)) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir nRet = nDropAction; 576cdf0e10cSrcweir static_cast< SdrHdlColor* >( pIAOHandle )->SetSize( SDR_HANDLE_COLOR_SIZE_SELECTED ); 577cdf0e10cSrcweir } 578cdf0e10cSrcweir else 579cdf0e10cSrcweir { 580cdf0e10cSrcweir static_cast< SdrHdlColor* >( pIAOHandle )->SetSize( SDR_HANDLE_COLOR_SIZE_NORMAL ); 581cdf0e10cSrcweir } 582cdf0e10cSrcweir } 583cdf0e10cSrcweir } 584cdf0e10cSrcweir } 585cdf0e10cSrcweir 586cdf0e10cSrcweir // check object insert 587cdf0e10cSrcweir if( !nRet && ( bXFillExchange || ( ( bDrawing || bGraphic || bMtf || bBitmap || bBookmark ) && ( nDropAction & DND_ACTION_LINK ) ) ) ) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir SdrObject* pPickObj = NULL; 590cdf0e10cSrcweir SdrPageView* pPageView = NULL; 591cdf0e10cSrcweir ::sd::Window* pWindow = mpViewSh->GetActiveWindow(); 592cdf0e10cSrcweir Point aPos( pWindow->PixelToLogic( rEvt.maPosPixel ) ); 593cdf0e10cSrcweir const sal_Bool bHasPickObj = PickObj( aPos, getHitTolLog(), pPickObj, pPageView ); 594cdf0e10cSrcweir sal_Bool bIsPresTarget = sal_False; 595cdf0e10cSrcweir 596cdf0e10cSrcweir if( bHasPickObj && pPickObj && ( pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall() ) ) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir SdPage* pPage = (SdPage*) pPickObj->GetPage(); 599cdf0e10cSrcweir 600cdf0e10cSrcweir if( pPage && pPage->IsMasterPage() ) 601cdf0e10cSrcweir bIsPresTarget = pPage->IsPresObj( pPickObj ); 602cdf0e10cSrcweir } 603cdf0e10cSrcweir 604cdf0e10cSrcweir if( bHasPickObj && !bIsPresTarget && 605cdf0e10cSrcweir ( !pPickObj->ISA( SdrGrafObj ) || bGraphic || bMtf || bBitmap || ( bXFillExchange && !pPickObj->ISA( SdrGrafObj ) && !pPickObj->ISA( SdrOle2Obj ) ) ) ) 606cdf0e10cSrcweir { 607cdf0e10cSrcweir if( mpDropMarkerObj != pPickObj ) 608cdf0e10cSrcweir { 609cdf0e10cSrcweir mpDropMarkerObj = pPickObj; 610cdf0e10cSrcweir ImplClearDrawDropMarker(); 611cdf0e10cSrcweir 612cdf0e10cSrcweir if(mpDropMarkerObj) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir mpDropMarker = new SdrDropMarkerOverlay(*this, *mpDropMarkerObj); 615cdf0e10cSrcweir } 616cdf0e10cSrcweir } 617cdf0e10cSrcweir 618cdf0e10cSrcweir nRet = nDropAction; 619cdf0e10cSrcweir } 620cdf0e10cSrcweir else 621cdf0e10cSrcweir bXFillExchange = sal_False; 622cdf0e10cSrcweir } 623cdf0e10cSrcweir 624cdf0e10cSrcweir // check normal insert 625cdf0e10cSrcweir if( !nRet ) 626cdf0e10cSrcweir { 627cdf0e10cSrcweir const sal_Bool bSBAFormat = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH ); 628cdf0e10cSrcweir const sal_Bool bEditEngine = rTargetHelper.IsDropFormatSupported( SOT_FORMATSTR_ID_EDITENGINE ); 629cdf0e10cSrcweir const sal_Bool bString = rTargetHelper.IsDropFormatSupported( FORMAT_STRING ); 630cdf0e10cSrcweir const sal_Bool bRTF = rTargetHelper.IsDropFormatSupported( FORMAT_RTF ); 631cdf0e10cSrcweir const sal_Bool bFile = rTargetHelper.IsDropFormatSupported( FORMAT_FILE ); 632cdf0e10cSrcweir const sal_Bool bFileList = rTargetHelper.IsDropFormatSupported( FORMAT_FILE_LIST ); 633cdf0e10cSrcweir 634cdf0e10cSrcweir if( mpDropMarker ) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir ImplClearDrawDropMarker(); 637cdf0e10cSrcweir mpDropMarkerObj = NULL; 638cdf0e10cSrcweir } 639cdf0e10cSrcweir 640cdf0e10cSrcweir if( bBookmark && bFile && ( nDropAction & DND_ACTION_MOVE ) && mpViewSh && SlideShow::IsRunning(mpViewSh->GetViewShellBase()) ) 641cdf0e10cSrcweir bBookmark = sal_False; 642cdf0e10cSrcweir 643cdf0e10cSrcweir if( bDrawing || bGraphic || bMtf || bBitmap || bBookmark || bFile || bFileList || bXFillExchange || bSBAFormat || bEditEngine || bString || bRTF ) 644cdf0e10cSrcweir nRet = nDropAction; 645cdf0e10cSrcweir 646cdf0e10cSrcweir // For entries from the navigator, change action copy. 647cdf0e10cSrcweir if (bBookmark 648cdf0e10cSrcweir && rTargetHelper.IsDropFormatSupported( 649cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable::GetListBoxDropFormatId()) 650cdf0e10cSrcweir && (nDropAction & DND_ACTION_MOVE)!=0) 651cdf0e10cSrcweir { 652cdf0e10cSrcweir nRet = DND_ACTION_COPY; 653cdf0e10cSrcweir } 654cdf0e10cSrcweir } 655cdf0e10cSrcweir } 656cdf0e10cSrcweir } 657cdf0e10cSrcweir } 658cdf0e10cSrcweir 659cdf0e10cSrcweir // destroy drop marker if this is a leaving event 660cdf0e10cSrcweir if( rEvt.mbLeaving && mpDropMarker ) 661cdf0e10cSrcweir { 662cdf0e10cSrcweir ImplClearDrawDropMarker(); 663cdf0e10cSrcweir mpDropMarkerObj = NULL; 664cdf0e10cSrcweir } 665cdf0e10cSrcweir 666cdf0e10cSrcweir return nRet; 667cdf0e10cSrcweir } 668cdf0e10cSrcweir 669cdf0e10cSrcweir // ----------------------------------------------------------------------------- 670cdf0e10cSrcweir 671cdf0e10cSrcweir sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper, 672cdf0e10cSrcweir ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer ) 673cdf0e10cSrcweir { 674cdf0e10cSrcweir SdrPageView* pPV = GetSdrPageView(); 675cdf0e10cSrcweir String aActiveLayer = GetActiveLayer(); 676cdf0e10cSrcweir sal_Int8 nDropAction = rEvt.mnAction; 677cdf0e10cSrcweir sal_Int8 nRet = DND_ACTION_NONE; 678cdf0e10cSrcweir 679cdf0e10cSrcweir // destroy drop marker if it is shown 680cdf0e10cSrcweir if( mpDropMarker ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir ImplClearDrawDropMarker(); 683cdf0e10cSrcweir mpDropMarkerObj = NULL; 684cdf0e10cSrcweir } 685cdf0e10cSrcweir 686cdf0e10cSrcweir if( !pPV->IsLayerLocked( aActiveLayer ) ) 687cdf0e10cSrcweir { 688cdf0e10cSrcweir const OutlinerView* pOLV = GetTextEditOutlinerView(); 689cdf0e10cSrcweir sal_Bool bIsInsideOutlinerView = sal_False; 690cdf0e10cSrcweir 691cdf0e10cSrcweir if( pOLV ) 692cdf0e10cSrcweir { 693cdf0e10cSrcweir Rectangle aRect( pOLV->GetOutputArea() ); 694cdf0e10cSrcweir 695cdf0e10cSrcweir if( GetMarkedObjectCount() == 1 ) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir SdrMark* pMark = GetSdrMarkByIndex(0); 698cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 699cdf0e10cSrcweir aRect.Union( pObj->GetLogicRect() ); 700cdf0e10cSrcweir } 701cdf0e10cSrcweir 702cdf0e10cSrcweir Point aPos( pOLV->GetWindow()->PixelToLogic( rEvt.maPosPixel ) ); 703cdf0e10cSrcweir 704cdf0e10cSrcweir if( aRect.IsInside( aPos ) ) 705cdf0e10cSrcweir { 706cdf0e10cSrcweir bIsInsideOutlinerView = sal_True; 707cdf0e10cSrcweir } 708cdf0e10cSrcweir } 709cdf0e10cSrcweir 710cdf0e10cSrcweir if( !bIsInsideOutlinerView ) 711cdf0e10cSrcweir { 712cdf0e10cSrcweir Point aPos; 713cdf0e10cSrcweir TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable ); 714cdf0e10cSrcweir 715cdf0e10cSrcweir if( pTargetWindow ) 716cdf0e10cSrcweir aPos = pTargetWindow->PixelToLogic( rEvt.maPosPixel ); 717cdf0e10cSrcweir 718cdf0e10cSrcweir // handle insert? 719cdf0e10cSrcweir if( (!nRet && ( SDRDRAG_GRADIENT == GetDragMode() )) || (( SDRDRAG_TRANSPARENCE == GetDragMode() ) && aDataHelper.HasFormat( SOT_FORMATSTR_ID_XFA )) ) 720cdf0e10cSrcweir { 721cdf0e10cSrcweir const SdrHdlList& rHdlList = GetHdlList(); 722cdf0e10cSrcweir 723cdf0e10cSrcweir for( sal_uInt32 n = 0; !nRet && n < rHdlList.GetHdlCount(); n++ ) 724cdf0e10cSrcweir { 725cdf0e10cSrcweir SdrHdl* pIAOHandle = rHdlList.GetHdl( n ); 726cdf0e10cSrcweir 727cdf0e10cSrcweir if( pIAOHandle && ( HDL_COLR == pIAOHandle->GetKind() ) ) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir if(pIAOHandle->getOverlayObjectList().isHitPixel(rEvt.maPosPixel)) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir SotStorageStreamRef xStm; 732cdf0e10cSrcweir 733cdf0e10cSrcweir if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_XFA, xStm ) && xStm.Is() ) 734cdf0e10cSrcweir { 735cdf0e10cSrcweir XFillExchangeData aFillData( XFillAttrSetItem( &mpDoc->GetPool() ) ); 736cdf0e10cSrcweir 737cdf0e10cSrcweir *xStm >> aFillData; 738cdf0e10cSrcweir const Color aColor( ( (XFillColorItem&) aFillData.GetXFillAttrSetItem()->GetItemSet().Get( XATTR_FILLCOLOR ) ).GetColorValue() ); 739cdf0e10cSrcweir static_cast< SdrHdlColor* >( pIAOHandle )->SetColor( aColor, sal_True ); 740cdf0e10cSrcweir nRet = nDropAction; 741cdf0e10cSrcweir } 742cdf0e10cSrcweir } 743cdf0e10cSrcweir } 744cdf0e10cSrcweir } 745cdf0e10cSrcweir } 746cdf0e10cSrcweir 747cdf0e10cSrcweir // standard insert? 748cdf0e10cSrcweir if( !nRet && InsertData( aDataHelper, aPos, nDropAction, sal_True, 0, nPage, nLayer ) ) 749cdf0e10cSrcweir nRet = nDropAction; 750cdf0e10cSrcweir 751cdf0e10cSrcweir // special insert? 752cdf0e10cSrcweir if( !nRet && mpViewSh ) 753cdf0e10cSrcweir { 754cdf0e10cSrcweir String aTmpString1, aTmpString2; 755cdf0e10cSrcweir INetBookmark aINetBookmark( aTmpString1, aTmpString2 ); 756cdf0e10cSrcweir 757cdf0e10cSrcweir // insert bookmark 758cdf0e10cSrcweir if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) && 759cdf0e10cSrcweir aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) 760cdf0e10cSrcweir { 761cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable* pPageObjsTransferable = SdPageObjsTLB::SdPageObjsTransferable::getImplementation( aDataHelper.GetXTransferable() ); 762cdf0e10cSrcweir 763cdf0e10cSrcweir if( pPageObjsTransferable && 764cdf0e10cSrcweir ( NAVIGATOR_DRAGTYPE_LINK == pPageObjsTransferable->GetDragType() || 765cdf0e10cSrcweir NAVIGATOR_DRAGTYPE_EMBEDDED == pPageObjsTransferable->GetDragType() ) ) 766cdf0e10cSrcweir { 767cdf0e10cSrcweir // insert bookmark from own navigator (handled async. due to possible message box ) 768cdf0e10cSrcweir Application::PostUserEvent( LINK( this, View, ExecuteNavigatorDrop ), 769cdf0e10cSrcweir new SdNavigatorDropEvent( rEvt, rTargetHelper, pTargetWindow, 770cdf0e10cSrcweir nPage, nLayer ) ); 771cdf0e10cSrcweir nRet = nDropAction; 772cdf0e10cSrcweir } 773cdf0e10cSrcweir else 774cdf0e10cSrcweir { 775cdf0e10cSrcweir SdrObject* pPickObj = NULL; 776cdf0e10cSrcweir SdrPageView* pPageView = NULL; 777cdf0e10cSrcweir 778cdf0e10cSrcweir if( PickObj( aPos, getHitTolLog(), pPickObj, pPageView ) ) 779cdf0e10cSrcweir { 780cdf0e10cSrcweir // insert as clip action => jump 781cdf0e10cSrcweir rtl::OUString aBookmark( aINetBookmark.GetURL() ); 782cdf0e10cSrcweir SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo( pPickObj ); 783cdf0e10cSrcweir sal_Bool bCreated = sal_False; 784cdf0e10cSrcweir 785cdf0e10cSrcweir if( aBookmark.getLength() ) 786cdf0e10cSrcweir { 787cdf0e10cSrcweir presentation::ClickAction eClickAction = presentation::ClickAction_DOCUMENT; 788cdf0e10cSrcweir 789cdf0e10cSrcweir sal_Int32 nIndex = aBookmark.indexOf( (sal_Unicode)'#' ); 790cdf0e10cSrcweir if( nIndex != -1 ) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir const String aDocName( aBookmark.copy( 0, nIndex ) ); 793cdf0e10cSrcweir 794cdf0e10cSrcweir if( mpDocSh->GetMedium()->GetName() == aDocName || mpDocSh->GetName() == aDocName ) 795cdf0e10cSrcweir { 796cdf0e10cSrcweir // internal jump, only use the part after and including '#' 797cdf0e10cSrcweir eClickAction = presentation::ClickAction_BOOKMARK; 798cdf0e10cSrcweir aBookmark = aBookmark.copy( nIndex+1 ); 799cdf0e10cSrcweir } 800cdf0e10cSrcweir } 801cdf0e10cSrcweir 802cdf0e10cSrcweir if( !pInfo ) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir pInfo = SdDrawDocument::GetShapeUserData( *pPickObj, true ); 805cdf0e10cSrcweir bCreated = sal_True; 806cdf0e10cSrcweir } 807cdf0e10cSrcweir 808cdf0e10cSrcweir // Undo-Action mit alten und neuen Groessen erzeugen 809cdf0e10cSrcweir SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction(mpDoc, pPickObj, bCreated); 810cdf0e10cSrcweir pAction->SetActive(pInfo->mbActive, pInfo->mbActive); 811cdf0e10cSrcweir pAction->SetEffect(pInfo->meEffect, pInfo->meEffect); 812cdf0e10cSrcweir pAction->SetTextEffect(pInfo->meTextEffect, pInfo->meTextEffect); 813cdf0e10cSrcweir pAction->SetSpeed(pInfo->meSpeed, pInfo->meSpeed); 814cdf0e10cSrcweir pAction->SetDim(pInfo->mbDimPrevious, pInfo->mbDimPrevious); 815cdf0e10cSrcweir pAction->SetDimColor(pInfo->maDimColor, pInfo->maDimColor); 816cdf0e10cSrcweir pAction->SetDimHide(pInfo->mbDimHide, pInfo->mbDimHide); 817cdf0e10cSrcweir pAction->SetSoundOn(pInfo->mbSoundOn, pInfo->mbSoundOn); 818cdf0e10cSrcweir pAction->SetSound(pInfo->maSoundFile, pInfo->maSoundFile); 819cdf0e10cSrcweir pAction->SetPlayFull(pInfo->mbPlayFull, pInfo->mbPlayFull); 820cdf0e10cSrcweir pAction->SetPathObj(pInfo->mpPathObj, pInfo->mpPathObj); 821cdf0e10cSrcweir pAction->SetClickAction(pInfo->meClickAction, eClickAction); 822cdf0e10cSrcweir pAction->SetBookmark(pInfo->GetBookmark(), aBookmark); 823cdf0e10cSrcweir // pAction->SetInvisibleInPres(pInfo->mbInvisibleInPresentation, sal_True); 824cdf0e10cSrcweir pAction->SetVerb(pInfo->mnVerb, pInfo->mnVerb); 825cdf0e10cSrcweir pAction->SetSecondEffect(pInfo->meSecondEffect, pInfo->meSecondEffect); 826cdf0e10cSrcweir pAction->SetSecondSpeed(pInfo->meSecondSpeed, pInfo->meSecondSpeed); 827cdf0e10cSrcweir pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, pInfo->mbSecondSoundOn); 828cdf0e10cSrcweir pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull, pInfo->mbSecondPlayFull); 829cdf0e10cSrcweir 830cdf0e10cSrcweir String aString(SdResId(STR_UNDO_ANIMATION)); 831cdf0e10cSrcweir pAction->SetComment(aString); 832cdf0e10cSrcweir mpDocSh->GetUndoManager()->AddUndoAction(pAction); 833cdf0e10cSrcweir pInfo->meClickAction = eClickAction; 834cdf0e10cSrcweir pInfo->SetBookmark( aBookmark ); 835cdf0e10cSrcweir mpDoc->SetChanged(); 836cdf0e10cSrcweir 837cdf0e10cSrcweir nRet = nDropAction; 838cdf0e10cSrcweir } 839cdf0e10cSrcweir } 840cdf0e10cSrcweir else if( mpViewSh->ISA( DrawViewShell ) ) 841cdf0e10cSrcweir { 842cdf0e10cSrcweir // insert as normal URL button 843cdf0e10cSrcweir ( (DrawViewShell*) mpViewSh )->InsertURLButton( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), String(), &aPos ); 844cdf0e10cSrcweir nRet = nDropAction; 845cdf0e10cSrcweir } 846cdf0e10cSrcweir } 847cdf0e10cSrcweir } 848cdf0e10cSrcweir } 849cdf0e10cSrcweir } 850cdf0e10cSrcweir } 851cdf0e10cSrcweir 852cdf0e10cSrcweir return nRet; 853cdf0e10cSrcweir } 854cdf0e10cSrcweir 855cdf0e10cSrcweir // ----------------------------------------------------------------------------- 856cdf0e10cSrcweir 857cdf0e10cSrcweir IMPL_LINK( View, ExecuteNavigatorDrop, SdNavigatorDropEvent*, pSdNavigatorDropEvent ) 858cdf0e10cSrcweir { 859cdf0e10cSrcweir TransferableDataHelper aDataHelper( pSdNavigatorDropEvent->maDropEvent.Transferable ); 860cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable* pPageObjsTransferable = SdPageObjsTLB::SdPageObjsTransferable::getImplementation( aDataHelper.GetXTransferable() ); 861cdf0e10cSrcweir INetBookmark aINetBookmark; 862cdf0e10cSrcweir 863cdf0e10cSrcweir if( pPageObjsTransferable && aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) 864cdf0e10cSrcweir { 865cdf0e10cSrcweir Point aPos; 866cdf0e10cSrcweir List aBookmarkList; 867cdf0e10cSrcweir String aBookmark; 868cdf0e10cSrcweir SdPage* pPage = (SdPage*) GetSdrPageView()->GetPage(); 869cdf0e10cSrcweir sal_uInt16 nPgPos = 0xFFFF; 870cdf0e10cSrcweir 871cdf0e10cSrcweir if( pSdNavigatorDropEvent->mpTargetWindow ) 872cdf0e10cSrcweir aPos = pSdNavigatorDropEvent->mpTargetWindow->PixelToLogic( pSdNavigatorDropEvent->maPosPixel ); 873cdf0e10cSrcweir 874cdf0e10cSrcweir const rtl::OUString aURL( aINetBookmark.GetURL() ); 875cdf0e10cSrcweir sal_Int32 nIndex = aURL.indexOf( (sal_Unicode)'#' ); 876cdf0e10cSrcweir if( nIndex != -1 ) 877cdf0e10cSrcweir aBookmark = aURL.copy( nIndex+1 ); 878cdf0e10cSrcweir aBookmarkList.Insert( &aBookmark ); 879cdf0e10cSrcweir 880cdf0e10cSrcweir if( !pPage->IsMasterPage() ) 881cdf0e10cSrcweir { 882cdf0e10cSrcweir if( pPage->GetPageKind() == PK_STANDARD ) 883cdf0e10cSrcweir nPgPos = pPage->GetPageNum() + 2; 884cdf0e10cSrcweir else if( pPage->GetPageKind() == PK_NOTES ) 885cdf0e10cSrcweir nPgPos = pPage->GetPageNum() + 1; 886cdf0e10cSrcweir } 887cdf0e10cSrcweir 888cdf0e10cSrcweir // Um zu gewaehrleisten, dass alle Seitennamen eindeutig sind, werden 889cdf0e10cSrcweir // die einzufuegenden geprueft und gegebenenfalls in einer Ersatzliste 890cdf0e10cSrcweir // aufgenommen (bNameOK == sal_False -> Benutzer hat abgebrochen) 891cdf0e10cSrcweir List* pExchangeList = NULL; 892cdf0e10cSrcweir sal_Bool bLink = ( NAVIGATOR_DRAGTYPE_LINK == pPageObjsTransferable->GetDragType() ? sal_True : sal_False ); 893cdf0e10cSrcweir sal_Bool bNameOK = GetExchangeList( pExchangeList, &aBookmarkList, 2 ); 894cdf0e10cSrcweir sal_Bool bReplace = sal_False; 895cdf0e10cSrcweir 896cdf0e10cSrcweir // Da man hier nicht weiss, ob es sich um eine Seite oder ein Objekt handelt, 897cdf0e10cSrcweir // wird eine Liste sowohl mit Seiten, als auch mit Objekten gefuellt. 898cdf0e10cSrcweir // Sollten Seitennamen und Objektnamen identisch sein gibt es hier natuerlich Probleme !!! 899cdf0e10cSrcweir if( bNameOK ) 900cdf0e10cSrcweir { 901cdf0e10cSrcweir mpDoc->InsertBookmark( &aBookmarkList, pExchangeList, 902cdf0e10cSrcweir bLink, bReplace, nPgPos, sal_False, 903cdf0e10cSrcweir &pPageObjsTransferable->GetDocShell(), 904cdf0e10cSrcweir sal_True, &aPos ); 905cdf0e10cSrcweir } 906cdf0e10cSrcweir 907cdf0e10cSrcweir // Loeschen der ExchangeList 908cdf0e10cSrcweir if( pExchangeList ) 909cdf0e10cSrcweir { 910cdf0e10cSrcweir for( void* p = pExchangeList->First(); p; p = pExchangeList->Next() ) 911cdf0e10cSrcweir delete (String*) p; 912cdf0e10cSrcweir 913cdf0e10cSrcweir delete pExchangeList; 914cdf0e10cSrcweir } 915cdf0e10cSrcweir } 916cdf0e10cSrcweir 917cdf0e10cSrcweir delete pSdNavigatorDropEvent; 918cdf0e10cSrcweir 919cdf0e10cSrcweir return 0; 920cdf0e10cSrcweir } 921cdf0e10cSrcweir 922cdf0e10cSrcweir /************************************************************************* 923cdf0e10cSrcweir |* 924cdf0e10cSrcweir |* Rueckgabeparameter: 925cdf0e10cSrcweir |* pExchangeList == NULL -> Namen sind alle eindeutig 926cdf0e10cSrcweir |* bNameOK == sal_False -> Benutzer hat abgebrochen 927cdf0e10cSrcweir |* nType == 0 -> Seiten 928cdf0e10cSrcweir |* nType == 1 -> Objekte 929cdf0e10cSrcweir |* nType == 2 -> Seiten + Objekte 930cdf0e10cSrcweir |* 931cdf0e10cSrcweir \************************************************************************/ 932cdf0e10cSrcweir 933cdf0e10cSrcweir sal_Bool View::GetExchangeList( List*& rpExchangeList, List* pBookmarkList, sal_uInt16 nType ) 934cdf0e10cSrcweir { 935cdf0e10cSrcweir DBG_ASSERT( !rpExchangeList, "ExchangeList muss NULL sein!"); 936cdf0e10cSrcweir 937cdf0e10cSrcweir sal_Bool bListIdentical = sal_True; // BookmarkList und ExchangeList sind gleich 938cdf0e10cSrcweir sal_Bool bNameOK = sal_True; // Name ist eindeutig 939cdf0e10cSrcweir 940cdf0e10cSrcweir rpExchangeList = new List(); 941cdf0e10cSrcweir 942cdf0e10cSrcweir if( pBookmarkList ) 943cdf0e10cSrcweir { 944cdf0e10cSrcweir String* pString = (String*) pBookmarkList->First(); 945cdf0e10cSrcweir 946cdf0e10cSrcweir while( pString && bNameOK ) 947cdf0e10cSrcweir { 948cdf0e10cSrcweir String* pNewName = new String( *pString ); 949cdf0e10cSrcweir 950cdf0e10cSrcweir if( nType == 0 || nType == 2 ) 951cdf0e10cSrcweir bNameOK = mpDocSh->CheckPageName ( 952cdf0e10cSrcweir mpViewSh->GetActiveWindow(), *pNewName); 953cdf0e10cSrcweir 954cdf0e10cSrcweir if( bNameOK && ( nType == 1 || nType == 2 ) ) 955cdf0e10cSrcweir { 956cdf0e10cSrcweir if( mpDoc->GetObj( *pNewName ) ) 957cdf0e10cSrcweir { 958cdf0e10cSrcweir String aTitle( SdResId( STR_TITLE_NAMEGROUP ) ); 959cdf0e10cSrcweir String aDesc( SdResId( STR_DESC_NAMEGROUP ) ); 960cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 961cdf0e10cSrcweir AbstractSvxNameDialog* pDlg = pFact ? pFact->CreateSvxNameDialog( mpViewSh->GetActiveWindow(), *pNewName, aDesc ) : 0; 962cdf0e10cSrcweir if( pDlg ) 963cdf0e10cSrcweir { 964cdf0e10cSrcweir pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_OBJECT ); 965cdf0e10cSrcweir 966cdf0e10cSrcweir bNameOK = sal_False; 967cdf0e10cSrcweir pDlg->SetText( aTitle ); 968cdf0e10cSrcweir 969cdf0e10cSrcweir while( !bNameOK && pDlg->Execute() == RET_OK ) 970cdf0e10cSrcweir { 971cdf0e10cSrcweir pDlg->GetName( *pNewName ); 972cdf0e10cSrcweir 973cdf0e10cSrcweir if( !mpDoc->GetObj( *pNewName ) ) 974cdf0e10cSrcweir bNameOK = sal_True; 975cdf0e10cSrcweir } 976cdf0e10cSrcweir 977cdf0e10cSrcweir delete pDlg; 978cdf0e10cSrcweir } 979cdf0e10cSrcweir } 980cdf0e10cSrcweir } 981cdf0e10cSrcweir 982cdf0e10cSrcweir if( bListIdentical ) 983cdf0e10cSrcweir bListIdentical = ( *pString == *pNewName ); 984cdf0e10cSrcweir 985cdf0e10cSrcweir rpExchangeList->Insert( pNewName, LIST_APPEND ); 986cdf0e10cSrcweir pString = (String*) pBookmarkList->Next(); 987cdf0e10cSrcweir } 988cdf0e10cSrcweir } 989cdf0e10cSrcweir 990cdf0e10cSrcweir // ExchangeList ist mit BookmarkList identisch 991cdf0e10cSrcweir if( rpExchangeList && bListIdentical ) 992cdf0e10cSrcweir { 993cdf0e10cSrcweir String* pString = (String*) rpExchangeList->First(); 994cdf0e10cSrcweir while( pString ) 995cdf0e10cSrcweir { 996cdf0e10cSrcweir delete pString; 997cdf0e10cSrcweir pString = (String*) rpExchangeList->Next(); 998cdf0e10cSrcweir } 999cdf0e10cSrcweir delete rpExchangeList; 1000cdf0e10cSrcweir rpExchangeList = NULL; 1001cdf0e10cSrcweir } 1002cdf0e10cSrcweir 1003cdf0e10cSrcweir return( bNameOK ); 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir typedef std::vector< std::pair< sal_uInt32, sal_uInt32 > > PathSurrogateVector; 1007cdf0e10cSrcweir typedef std::vector< SdrObject* > SdrObjectVector; 1008cdf0e10cSrcweir 1009cdf0e10cSrcweir void ImplProcessObjectList(SdrObject* pObj, SdrObjectVector& rVector ) 1010cdf0e10cSrcweir { 1011cdf0e10cSrcweir sal_Bool bIsGroup(pObj->IsGroupObject()); 1012cdf0e10cSrcweir if(bIsGroup && pObj->ISA(E3dObject) && !pObj->ISA(E3dScene)) 1013cdf0e10cSrcweir bIsGroup = sal_False; 1014cdf0e10cSrcweir 1015cdf0e10cSrcweir rVector.push_back( pObj ); 1016cdf0e10cSrcweir 1017cdf0e10cSrcweir if(bIsGroup) 1018cdf0e10cSrcweir { 1019cdf0e10cSrcweir SdrObjList* pObjList = pObj->GetSubList(); 1020cdf0e10cSrcweir sal_uInt32 a; 1021cdf0e10cSrcweir for( a = 0; a < pObjList->GetObjCount(); a++) 1022cdf0e10cSrcweir ImplProcessObjectList(pObjList->GetObj(a), rVector); 1023cdf0e10cSrcweir } 1024cdf0e10cSrcweir } 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir SdrModel* View::GetMarkedObjModel() const 1027cdf0e10cSrcweir { 1028cdf0e10cSrcweir return FmFormView::GetMarkedObjModel();; 1029cdf0e10cSrcweir } 1030cdf0e10cSrcweir 1031cdf0e10cSrcweir sal_Bool View::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst /* =NULL */, sal_uInt32 nOptions /* =0 */) 1032cdf0e10cSrcweir { 1033cdf0e10cSrcweir return FmFormView::Paste( rMod, rPos, pLst,nOptions );; 1034cdf0e10cSrcweir } 1035cdf0e10cSrcweir 1036cdf0e10cSrcweir } // end of namespace sd 1037