LCOV - code coverage report
Current view: top level - sd/source/ui/view - sdview2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 23 469 4.9 %
Date: 2012-08-25 Functions: 2 19 10.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 33 1158 2.8 %

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

Generated by: LCOV version 1.10