LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/view - sdview2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 24 473 5.1 %
Date: 2013-07-09 Functions: 4 21 19.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10