LCOV - code coverage report
Current view: top level - sd/source/ui/view - sdview3.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 699 0.1 %
Date: 2012-08-25 Functions: 2 7 28.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 1900 0.1 %

           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                 :            : 
      30                 :            : #include "View.hxx"
      31                 :            : #include <com/sun/star/embed/XEmbedObjectClipboardCreator.hpp>
      32                 :            : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
      33                 :            : #include <com/sun/star/lang/XComponent.hpp>
      34                 :            : #include <sot/filelist.hxx>
      35                 :            : #include <unotools/pathoptions.hxx>
      36                 :            : #include <editeng/editdata.hxx>
      37                 :            : #include <svl/urlbmk.hxx>
      38                 :            : #include <svx/xexch.hxx>
      39                 :            : #include <svx/xflclit.hxx>
      40                 :            : #include <svx/xlnclit.hxx>
      41                 :            : #include <svx/svdpagv.hxx>
      42                 :            : #include <editeng/eeitem.hxx>
      43                 :            : #include <editeng/colritem.hxx>
      44                 :            : #include <sfx2/docfile.hxx>
      45                 :            : #include <svx/svditer.hxx>
      46                 :            : #include <svx/svdogrp.hxx>
      47                 :            : #include <svx/svdoole2.hxx>
      48                 :            : #include <svx/svdograf.hxx>
      49                 :            : #include <svx/svdetc.hxx>
      50                 :            : #include <svx/svdundo.hxx>
      51                 :            : #include <sfx2/app.hxx>
      52                 :            : #include <svl/itempool.hxx>
      53                 :            : #include <sot/clsids.hxx>
      54                 :            : #include <svx/fmmodel.hxx>
      55                 :            : #include <sot/formats.hxx>
      56                 :            : #include <editeng/outliner.hxx>
      57                 :            : #include <editeng/editeng.hxx>
      58                 :            : #include <svx/obj3d.hxx>
      59                 :            : #include <svx/e3dundo.hxx>
      60                 :            : #include <svx/unomodel.hxx>
      61                 :            : #include <unotools/streamwrap.hxx>
      62                 :            : #include <vcl/metaact.hxx>
      63                 :            : #include <svx/svxids.hrc>
      64                 :            : #include <toolkit/helper/vclunohelper.hxx>
      65                 :            : 
      66                 :            : #include "DrawDocShell.hxx"
      67                 :            : #include "fupoor.hxx"
      68                 :            : #include "Window.hxx"
      69                 :            : #include "sdxfer.hxx"
      70                 :            : #include "sdpage.hxx"
      71                 :            : #include "DrawViewShell.hxx"
      72                 :            : #include "drawdoc.hxx"
      73                 :            : #include "sdresid.hxx"
      74                 :            : #include "strings.hrc"
      75                 :            : #include "imapinfo.hxx"
      76                 :            : #include "SlideSorterViewShell.hxx"
      77                 :            : #include "strmname.h"
      78                 :            : #include "unomodel.hxx"
      79                 :            : #include "ViewClipboard.hxx"
      80                 :            : 
      81                 :            : #include <sfx2/ipclient.hxx>
      82                 :            : #include <comphelper/storagehelper.hxx>
      83                 :            : #include <comphelper/processfactory.hxx>
      84                 :            : #include <tools/stream.hxx>
      85                 :            : #include <vcl/cvtgrf.hxx>
      86                 :            : #include <svx/sdrhittesthelper.hxx>
      87                 :            : 
      88                 :            : // --------------
      89                 :            : // - Namespaces -
      90                 :            : // --------------
      91                 :            : 
      92                 :            : using namespace ::com::sun::star;
      93                 :            : using namespace ::com::sun::star::lang;
      94                 :            : using namespace ::com::sun::star::uno;
      95                 :            : using namespace ::com::sun::star::io;
      96                 :            : using namespace ::com::sun::star::datatransfer;
      97                 :            : using namespace ::com::sun::star::datatransfer::clipboard;
      98                 :            : 
      99                 :            : namespace sd {
     100                 :            : 
     101                 :            : #define CHECK_FORMAT_TRANS( _def_Type ) ( ( nFormat == (_def_Type) || !nFormat ) && aDataHelper.HasFormat( _def_Type ) )
     102                 :            : 
     103                 :            : /*************************************************************************
     104                 :            : |*
     105                 :            : |* Paste
     106                 :            : |*
     107                 :            : \************************************************************************/
     108                 :            : 
     109                 :            : struct ImpRememberOrigAndClone
     110                 :            : {
     111                 :            :     SdrObject*      pOrig;
     112                 :            :     SdrObject*      pClone;
     113                 :            : };
     114                 :            : 
     115                 :          0 : SdrObject* ImpGetClone(std::vector<ImpRememberOrigAndClone*>& aConnectorContainer, SdrObject* pConnObj)
     116                 :            : {
     117         [ #  # ]:          0 :     for(sal_uInt32 a(0); a < aConnectorContainer.size(); a++)
     118                 :            :     {
     119         [ #  # ]:          0 :         if(pConnObj == aConnectorContainer[a]->pOrig)
     120                 :          0 :             return aConnectorContainer[a]->pClone;
     121                 :            :     }
     122                 :          0 :     return 0L;
     123                 :            : }
     124                 :            : 
     125                 :            : // restrict movement to WorkArea
     126                 :          0 : void ImpCheckInsertPos(Point& rPos, const Size& rSize, const Rectangle& rWorkArea)
     127                 :            : {
     128         [ #  # ]:          0 :     if(!rWorkArea.IsEmpty())
     129                 :            :     {
     130         [ #  # ]:          0 :         Rectangle aMarkRect(Point(rPos.X() - (rSize.Width() / 2), rPos.Y() - (rSize.Height() / 2)), rSize);
     131                 :            : 
     132 [ #  # ][ #  # ]:          0 :         if(!aMarkRect.IsInside(rWorkArea))
     133                 :            :         {
     134         [ #  # ]:          0 :             if(aMarkRect.Left() < rWorkArea.Left())
     135                 :            :             {
     136                 :          0 :                 rPos.X() += rWorkArea.Left() - aMarkRect.Left();
     137                 :            :             }
     138                 :            : 
     139         [ #  # ]:          0 :             if(aMarkRect.Right() > rWorkArea.Right())
     140                 :            :             {
     141                 :          0 :                 rPos.X() -= aMarkRect.Right() - rWorkArea.Right();
     142                 :            :             }
     143                 :            : 
     144         [ #  # ]:          0 :             if(aMarkRect.Top() < rWorkArea.Top())
     145                 :            :             {
     146                 :          0 :                 rPos.Y() += rWorkArea.Top() - aMarkRect.Top();
     147                 :            :             }
     148                 :            : 
     149         [ #  # ]:          0 :             if(aMarkRect.Bottom() > rWorkArea.Bottom())
     150                 :            :             {
     151                 :          0 :                 rPos.Y() -= aMarkRect.Bottom() - rWorkArea.Bottom();
     152                 :            :             }
     153                 :            :         }
     154                 :            :     }
     155                 :          0 : }
     156                 :            : 
     157                 :          0 : bool View::InsertMetaFile( TransferableDataHelper& rDataHelper, const Point& rPos, ImageMap* pImageMap, bool bOptimize )
     158                 :            : {
     159         [ #  # ]:          0 :     GDIMetaFile aMtf;
     160                 :            : 
     161 [ #  # ][ #  # ]:          0 :     if( !rDataHelper.GetGDIMetaFile( FORMAT_GDIMETAFILE, aMtf ) )
     162                 :          0 :         return false;
     163                 :            : 
     164                 :          0 :     bool bVector = false;
     165         [ #  # ]:          0 :     Graphic aGraphic;
     166                 :            : 
     167                 :            :     // check if metafile only contains a pixel image, if so insert a bitmap instead
     168         [ #  # ]:          0 :     if( bOptimize )
     169                 :            :     {
     170         [ #  # ]:          0 :         MetaAction* pAction = aMtf.FirstAction();
     171 [ #  # ][ #  # ]:          0 :         while( pAction && !bVector )
                 [ #  # ]
     172                 :            :         {
     173      [ #  #  # ]:          0 :             switch( pAction->GetType() )
     174                 :            :             {
     175                 :            :                 case META_POINT_ACTION:
     176                 :            :                 case META_LINE_ACTION:
     177                 :            :                 case META_RECT_ACTION:
     178                 :            :                 case META_ROUNDRECT_ACTION:
     179                 :            :                 case META_ELLIPSE_ACTION:
     180                 :            :                 case META_ARC_ACTION:
     181                 :            :                 case META_PIE_ACTION:
     182                 :            :                 case META_CHORD_ACTION:
     183                 :            :                 case META_POLYLINE_ACTION:
     184                 :            :                 case META_POLYGON_ACTION:
     185                 :            :                 case META_POLYPOLYGON_ACTION:
     186                 :            :                 case META_TEXT_ACTION:
     187                 :            :                 case META_TEXTARRAY_ACTION:
     188                 :            :                 case META_STRETCHTEXT_ACTION:
     189                 :            :                 case META_TEXTRECT_ACTION:
     190                 :            :                 case META_GRADIENT_ACTION:
     191                 :            :                 case META_HATCH_ACTION:
     192                 :            :                 case META_WALLPAPER_ACTION:
     193                 :            :                 case META_EPS_ACTION:
     194                 :            :                 case META_TEXTLINE_ACTION:
     195                 :            :                 case META_FLOATTRANSPARENT_ACTION:
     196                 :            :                 case META_GRADIENTEX_ACTION:
     197                 :            :                 case META_BMPSCALEPART_ACTION:
     198                 :            :                 case META_BMPEXSCALEPART_ACTION:
     199                 :            :                 case META_RENDERGRAPHIC_ACTION:
     200                 :          0 :                     bVector = true;
     201                 :          0 :                     break;
     202                 :            :                 case META_BMP_ACTION:
     203                 :            :                 case META_BMPSCALE_ACTION:
     204                 :            :                 case META_BMPEX_ACTION:
     205                 :            :                 case META_BMPEXSCALE_ACTION:
     206 [ #  # ][ #  # ]:          0 :                     if( aGraphic.GetType() != GRAPHIC_NONE )
     207                 :            :                     {
     208                 :          0 :                         bVector = true;
     209                 :            :                     }
     210   [ #  #  #  #  :          0 :                     else switch( pAction->GetType() )
                      # ]
     211                 :            :                     {
     212                 :            :                         case META_BMP_ACTION:
     213                 :            :                             {
     214         [ #  # ]:          0 :                                 MetaBmpAction* pBmpAction = dynamic_cast< MetaBmpAction* >( pAction );
     215         [ #  # ]:          0 :                                 if( pBmpAction )
     216 [ #  # ][ #  # ]:          0 :                                     aGraphic = Graphic( pBmpAction->GetBitmap() );
                 [ #  # ]
     217                 :            :                             }
     218                 :          0 :                             break;
     219                 :            :                         case META_BMPSCALE_ACTION:
     220                 :            :                             {
     221         [ #  # ]:          0 :                                 MetaBmpScaleAction* pBmpScaleAction = dynamic_cast< MetaBmpScaleAction* >( pAction );
     222         [ #  # ]:          0 :                                 if( pBmpScaleAction )
     223 [ #  # ][ #  # ]:          0 :                                     aGraphic = Graphic( pBmpScaleAction->GetBitmap() );
                 [ #  # ]
     224                 :            :                             }
     225                 :          0 :                             break;
     226                 :            :                         case META_BMPEX_ACTION:
     227                 :            :                             {
     228         [ #  # ]:          0 :                                 MetaBmpExAction* pBmpExAction = dynamic_cast< MetaBmpExAction* >( pAction );
     229         [ #  # ]:          0 :                                 if( pBmpExAction )
     230 [ #  # ][ #  # ]:          0 :                                     aGraphic = Graphic( pBmpExAction->GetBitmapEx() );
                 [ #  # ]
     231                 :            :                             }
     232                 :          0 :                             break;
     233                 :            :                         case META_BMPEXSCALE_ACTION:
     234                 :            :                             {
     235         [ #  # ]:          0 :                                 MetaBmpExScaleAction* pBmpExScaleAction = dynamic_cast< MetaBmpExScaleAction* >( pAction );
     236         [ #  # ]:          0 :                                 if( pBmpExScaleAction )
     237 [ #  # ][ #  # ]:          0 :                                     aGraphic = Graphic( pBmpExScaleAction->GetBitmapEx() );
                 [ #  # ]
     238                 :            :                             }
     239                 :          0 :                             break;
     240                 :            :                     }
     241                 :            :             }
     242                 :            : 
     243         [ #  # ]:          0 :             pAction = aMtf.NextAction();
     244                 :            :         }
     245                 :            :     }
     246                 :            : 
     247                 :            :     // it is not a vector metafile but it also has no graphic?
     248 [ #  # ][ #  # ]:          0 :     if( !bVector && (aGraphic.GetType() == GRAPHIC_NONE) )
         [ #  # ][ #  # ]
     249                 :          0 :         bVector = true;
     250                 :            : 
     251                 :            :     // restrict movement to WorkArea
     252                 :          0 :     Point aInsertPos( rPos );
     253                 :          0 :     Size aImageSize;
     254 [ #  # ][ #  # ]:          0 :     aImageSize = bVector ? aMtf.GetPrefSize() : aGraphic.GetSizePixel();
     255         [ #  # ]:          0 :     ImpCheckInsertPos(aInsertPos, aImageSize, GetWorkArea());
     256                 :            : 
     257         [ #  # ]:          0 :     if( bVector )
     258 [ #  # ][ #  # ]:          0 :         aGraphic = Graphic( aMtf );
                 [ #  # ]
     259                 :            : 
     260         [ #  # ]:          0 :     aGraphic.SetPrefMapMode( aMtf.GetPrefMapMode() );
     261         [ #  # ]:          0 :     aGraphic.SetPrefSize( aMtf.GetPrefSize() );
     262         [ #  # ]:          0 :     InsertGraphic( aGraphic, mnAction, aInsertPos, NULL, pImageMap );
     263                 :            : 
     264 [ #  # ][ #  # ]:          0 :     return true;
     265                 :            : }
     266                 :            : 
     267                 :          0 : sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
     268                 :            :                          const Point& rPos, sal_Int8& rDnDAction, sal_Bool bDrag,
     269                 :            :                          sal_uLong nFormat, sal_uInt16 nPage, sal_uInt16 nLayer )
     270                 :            : {
     271                 :          0 :     maDropPos = rPos;
     272                 :          0 :     mnAction = rDnDAction;
     273                 :          0 :     mbIsDropAllowed = sal_False;
     274                 :            : 
     275         [ #  # ]:          0 :     TransferableDataHelper  aDataHelper( rDataHelper );
     276                 :          0 :     SdrObject*              pPickObj = NULL;
     277                 :          0 :     SdPage*                 pPage = NULL;
     278                 :          0 :     ImageMap*               pImageMap = NULL;
     279                 :          0 :     sal_Bool                    bReturn = sal_False;
     280                 :          0 :     sal_Bool                    bLink = ( ( mnAction & DND_ACTION_LINK ) != 0 );
     281 [ #  # ][ #  # ]:          0 :     sal_Bool                    bCopy = ( ( ( mnAction & DND_ACTION_COPY ) != 0 ) || bLink );
     282                 :          0 :     sal_uLong                   nPasteOptions = SDRINSERT_SETDEFLAYER;
     283                 :            : 
     284         [ #  # ]:          0 :     if (mpViewSh != NULL)
     285                 :            :     {
     286                 :            :         OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
     287 [ #  # ][ #  # ]:          0 :         SfxInPlaceClient* pIpClient = mpViewSh->GetViewShell()->GetIPClient();
     288 [ #  # ][ #  # ]:          0 :         if( mpViewSh->ISA(::sd::slidesorter::SlideSorterViewShell)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     289         [ #  # ]:          0 :             || (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive()))
     290                 :          0 :         nPasteOptions |= SDRINSERT_DONTMARK;
     291                 :            :     }
     292                 :            : 
     293         [ #  # ]:          0 :     if( bDrag )
     294                 :            :     {
     295                 :          0 :         SdrPageView* pPV = NULL;
     296         [ #  # ]:          0 :         PickObj( rPos, getHitTolLog(), pPickObj, pPV );
     297                 :            :     }
     298                 :            : 
     299         [ #  # ]:          0 :     if( nPage != SDRPAGE_NOTFOUND )
     300         [ #  # ]:          0 :         pPage = (SdPage*) mrDoc.GetPage( nPage );
     301                 :            : 
     302                 :          0 :     SdTransferable* pOwnData = NULL;
     303                 :          0 :     SdTransferable* pImplementation = SdTransferable::getImplementation( aDataHelper.GetTransferable() );
     304                 :            : 
     305                 :            :     // try to get own transfer data
     306         [ #  # ]:          0 :     if( pImplementation )
     307                 :            :     {
     308 [ #  # ][ #  # ]:          0 :         if( SD_MOD()->pTransferClip == (SdTransferable*) pImplementation )
     309         [ #  # ]:          0 :             pOwnData = SD_MOD()->pTransferClip;
     310 [ #  # ][ #  # ]:          0 :         else if( SD_MOD()->pTransferDrag == (SdTransferable*) pImplementation )
     311         [ #  # ]:          0 :             pOwnData = SD_MOD()->pTransferDrag;
     312 [ #  # ][ #  # ]:          0 :         else if( SD_MOD()->pTransferSelection == (SdTransferable*) pImplementation )
     313         [ #  # ]:          0 :             pOwnData = SD_MOD()->pTransferSelection;
     314                 :            :     }
     315                 :            : 
     316                 :            :     // ImageMap?
     317 [ #  # ][ #  # ]:          0 :     if( !pOwnData && aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVIM ) )
         [ #  # ][ #  # ]
     318                 :            :     {
     319                 :          0 :         SotStorageStreamRef xStm;
     320                 :            : 
     321 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_SVIM, xStm ) )
     322                 :            :         {
     323 [ #  # ][ #  # ]:          0 :             pImageMap = new ImageMap;
     324                 :            :             // mba: clipboard always must contain absolute URLs (could be from alien source)
     325 [ #  # ][ #  # ]:          0 :             pImageMap->Read( *xStm, String() );
                 [ #  # ]
     326         [ #  # ]:          0 :         }
     327                 :            :     }
     328                 :            : 
     329                 :          0 :     bool bTable = false;
     330                 :            :     // check special cases for pasting table formats as RTL
     331 [ #  # ][ #  # ]:          0 :     if( !bLink && (!nFormat || (nFormat == SOT_FORMAT_RTF)) )
                 [ #  # ]
     332                 :            :     {
     333                 :            :         // if the objekt supports rtf and there is a table involved, default is to create a table
     334 [ #  # ][ #  # ]:          0 :         if( aDataHelper.HasFormat( SOT_FORMAT_RTF ) && ! aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     335                 :            :         {
     336                 :          0 :             SotStorageStreamRef xStm;
     337                 :            : 
     338 [ #  # ][ #  # ]:          0 :             if( aDataHelper.GetSotStorageStream( FORMAT_RTF, xStm ) )
     339                 :            :             {
     340         [ #  # ]:          0 :                 xStm->Seek( 0 );
     341                 :            : 
     342                 :          0 :                 rtl::OString aLine;
     343 [ #  # ][ #  # ]:          0 :                 while (xStm->ReadLine(aLine))
     344                 :            :                 {
     345                 :          0 :                     sal_Int32 x = aLine.indexOf( "\\trowd" );
     346         [ #  # ]:          0 :                     if (x != -1)
     347                 :            :                     {
     348                 :          0 :                         bTable = true;
     349                 :          0 :                         nFormat = FORMAT_RTF;
     350                 :          0 :                         break;
     351                 :            :                     }
     352                 :          0 :                 }
     353         [ #  # ]:          0 :             }
     354                 :            :         }
     355                 :            :     }
     356                 :            : 
     357 [ #  # ][ #  # ]:          0 :     if( pOwnData && !nFormat )
     358                 :            :     {
     359                 :          0 :         const View* pSourceView = pOwnData->GetView();
     360                 :            : 
     361                 :            : 
     362 [ #  # ][ #  # ]:          0 :         if( pOwnData->GetDocShell() && pOwnData->IsPageTransferable() && ISA( View ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     363                 :            :         {
     364         [ #  # ]:          0 :             mpClipboard->HandlePageDrop (*pOwnData);
     365                 :            :         }
     366         [ #  # ]:          0 :         else if( pSourceView )
     367                 :            :         {
     368         [ #  # ]:          0 :             if( pSourceView == this )
     369                 :            :             {
     370                 :            :                 // same view
     371         [ #  # ]:          0 :                 if( nLayer != SDRLAYER_NOTFOUND )
     372                 :            :                 {
     373                 :            :                     // drop on layer tab bar
     374                 :          0 :                     SdrLayerAdmin&  rLayerAdmin = mrDoc.GetLayerAdmin();
     375         [ #  # ]:          0 :                     SdrLayer*       pLayer = rLayerAdmin.GetLayerPerID( nLayer );
     376                 :          0 :                     SdrPageView*    pPV = GetSdrPageView();
     377         [ #  # ]:          0 :                     String          aLayer( pLayer->GetName() );
     378                 :            : 
     379 [ #  # ][ #  # ]:          0 :                     if( !pPV->IsLayerLocked( aLayer ) )
     380                 :            :                     {
     381                 :          0 :                         pOwnData->SetInternalMove( sal_True );
     382         [ #  # ]:          0 :                         SortMarkedObjects();
     383                 :            : 
     384         [ #  # ]:          0 :                         for( sal_uLong nM = 0; nM < GetMarkedObjectCount(); nM++ )
     385                 :            :                         {
     386         [ #  # ]:          0 :                             SdrMark*    pM = GetSdrMarkByIndex( nM );
     387         [ #  # ]:          0 :                             SdrObject*  pO = pM->GetMarkedSdrObj();
     388                 :            : 
     389         [ #  # ]:          0 :                             if( pO )
     390                 :            :                             {
     391                 :            :                                 // #i11702#
     392 [ #  # ][ #  # ]:          0 :                                 if( IsUndoEnabled() )
     393                 :            :                                 {
     394 [ #  # ][ #  # ]:          0 :                                     BegUndo(String(SdResId(STR_MODIFYLAYER)));
         [ #  # ][ #  # ]
     395 [ #  # ][ #  # ]:          0 :                                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectLayerChange(*pO, pO->GetLayer(), (SdrLayerID)nLayer));
         [ #  # ][ #  # ]
     396         [ #  # ]:          0 :                                     EndUndo();
     397                 :            :                                 }
     398                 :            : 
     399         [ #  # ]:          0 :                                 pO->SetLayer( (SdrLayerID) nLayer );
     400                 :            :                             }
     401                 :            :                         }
     402                 :            : 
     403                 :          0 :                         bReturn = sal_True;
     404         [ #  # ]:          0 :                     }
     405                 :            :                 }
     406                 :            :                 else
     407                 :            :                 {
     408                 :          0 :                     SdrPageView*    pPV = GetSdrPageView();
     409                 :          0 :                     sal_Bool            bDropOnTabBar = sal_True;
     410                 :            : 
     411 [ #  # ][ #  # ]:          0 :                     if( !pPage && pPV->GetPage()->GetPageNum() != mnDragSrcPgNum )
         [ #  # ][ #  # ]
     412                 :            :                     {
     413                 :          0 :                         pPage = (SdPage*) pPV->GetPage();
     414                 :          0 :                         bDropOnTabBar = sal_False;
     415                 :            :                     }
     416                 :            : 
     417         [ #  # ]:          0 :                     if( pPage )
     418                 :            :                     {
     419                 :            :                         // drop on other page
     420         [ #  # ]:          0 :                         String aActiveLayer( GetActiveLayer() );
     421                 :            : 
     422 [ #  # ][ #  # ]:          0 :                         if( !pPV->IsLayerLocked( aActiveLayer ) )
     423                 :            :                         {
     424 [ #  # ][ #  # ]:          0 :                             if( !IsPresObjSelected() )
     425                 :            :                             {
     426                 :            :                                 SdrMarkList* pMarkList;
     427                 :            : 
     428 [ #  # ][ #  # ]:          0 :                                 if( (mnDragSrcPgNum != SDRPAGE_NOTFOUND) && (mnDragSrcPgNum != pPV->GetPage()->GetPageNum()) )
         [ #  # ][ #  # ]
     429                 :            :                                 {
     430                 :          0 :                                     pMarkList = mpDragSrcMarkList;
     431                 :            :                                 }
     432                 :            :                                 else
     433                 :            :                                 {
     434                 :            :                                     // actual mark list is used
     435 [ #  # ][ #  # ]:          0 :                                     pMarkList = new SdrMarkList( GetMarkedObjectList());
     436                 :            :                                 }
     437                 :            : 
     438         [ #  # ]:          0 :                                 pMarkList->ForceSort();
     439                 :            : 
     440                 :            :                                 // stuff to remember originals and clones
     441         [ #  # ]:          0 :                                 std::vector<ImpRememberOrigAndClone*> aConnectorContainer;
     442                 :          0 :                                 sal_uInt32  a, nConnectorCount(0L);
     443                 :          0 :                                 Point       aCurPos;
     444                 :            : 
     445                 :            :                                 // calculate real position of current
     446                 :            :                                 // source objects, if necessary (#103207)
     447 [ #  # ][ #  # ]:          0 :                                 if( pOwnData == SD_MOD()->pTransferSelection )
     448                 :            :                                 {
     449         [ #  # ]:          0 :                                     Rectangle aCurBoundRect;
     450                 :            : 
     451 [ #  # ][ #  # ]:          0 :                                     if( pMarkList->TakeBoundRect( pPV, aCurBoundRect ) )
     452                 :          0 :                                         aCurPos = aCurBoundRect.TopLeft();
     453                 :            :                                     else
     454                 :          0 :                                         aCurPos = pOwnData->GetStartPos();
     455                 :            :                                 }
     456                 :            :                                 else
     457                 :          0 :                                     aCurPos = pOwnData->GetStartPos();
     458                 :            : 
     459                 :          0 :                                 const Size aVector( maDropPos.X() - aCurPos.X(), maDropPos.Y() - aCurPos.Y() );
     460                 :            : 
     461         [ #  # ]:          0 :                                 for(a = 0; a < pMarkList->GetMarkCount(); a++)
     462                 :            :                                 {
     463         [ #  # ]:          0 :                                     SdrMark* pM = pMarkList->GetMark(a);
     464 [ #  # ][ #  # ]:          0 :                                     SdrObject* pObj = pM->GetMarkedSdrObj()->Clone();
     465                 :            : 
     466         [ #  # ]:          0 :                                     if(pObj)
     467                 :            :                                     {
     468         [ #  # ]:          0 :                                         if(!bDropOnTabBar)
     469                 :            :                                         {
     470                 :            :                                             // do a NbcMove(...) instead of setting SnapRects here
     471         [ #  # ]:          0 :                                             pObj->NbcMove(aVector);
     472                 :            :                                         }
     473                 :            : 
     474         [ #  # ]:          0 :                                         pPage->InsertObject(pObj);
     475                 :            : 
     476 [ #  # ][ #  # ]:          0 :                                         if( IsUndoEnabled() )
     477                 :            :                                         {
     478 [ #  # ][ #  # ]:          0 :                                             BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
         [ #  # ][ #  # ]
     479 [ #  # ][ #  # ]:          0 :                                             AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj));
                 [ #  # ]
     480         [ #  # ]:          0 :                                             EndUndo();
     481                 :            :                                         }
     482                 :            : 
     483         [ #  # ]:          0 :                                         ImpRememberOrigAndClone* pRem = new ImpRememberOrigAndClone;
     484         [ #  # ]:          0 :                                         pRem->pOrig = pM->GetMarkedSdrObj();
     485                 :          0 :                                         pRem->pClone = pObj;
     486         [ #  # ]:          0 :                                         aConnectorContainer.push_back(pRem);
     487                 :            : 
     488 [ #  # ][ #  # ]:          0 :                                         if(pObj->ISA(SdrEdgeObj))
                 [ #  # ]
     489                 :          0 :                                             nConnectorCount++;
     490                 :            :                                     }
     491                 :            :                                 }
     492                 :            : 
     493                 :            :                                 // try to re-establish connections at clones
     494         [ #  # ]:          0 :                                 if(nConnectorCount)
     495                 :            :                                 {
     496         [ #  # ]:          0 :                                     for(a = 0; a < aConnectorContainer.size(); a++)
     497                 :            :                                     {
     498                 :          0 :                                         ImpRememberOrigAndClone* pRem = aConnectorContainer[a];
     499                 :            : 
     500 [ #  # ][ #  # ]:          0 :                                         if(pRem->pClone->ISA(SdrEdgeObj))
                 [ #  # ]
     501                 :            :                                         {
     502                 :          0 :                                             SdrEdgeObj* pOrigEdge = (SdrEdgeObj*)pRem->pOrig;
     503                 :          0 :                                             SdrEdgeObj* pCloneEdge = (SdrEdgeObj*)pRem->pClone;
     504                 :            : 
     505                 :            :                                             // test first connection
     506                 :          0 :                                             SdrObjConnection& rConn0 = pOrigEdge->GetConnection(sal_False);
     507                 :          0 :                                             SdrObject* pConnObj = rConn0.GetObject();
     508         [ #  # ]:          0 :                                             if(pConnObj)
     509                 :            :                                             {
     510         [ #  # ]:          0 :                                                 SdrObject* pConnClone = ImpGetClone(aConnectorContainer, pConnObj);
     511         [ #  # ]:          0 :                                                 if(pConnClone)
     512                 :            :                                                 {
     513                 :            :                                                     // if dest obj was cloned, too, re-establish connection
     514         [ #  # ]:          0 :                                                     pCloneEdge->ConnectToNode(sal_False, pConnClone);
     515                 :          0 :                                                     pCloneEdge->GetConnection(sal_False).SetConnectorId(rConn0.GetConnectorId());
     516                 :            :                                                 }
     517                 :            :                                                 else
     518                 :            :                                                 {
     519                 :            :                                                     // set position of connection point of original connected object
     520         [ #  # ]:          0 :                                                     const SdrGluePointList* pGlueList = pConnObj->GetGluePointList();
     521         [ #  # ]:          0 :                                                     if(pGlueList)
     522                 :            :                                                     {
     523         [ #  # ]:          0 :                                                         sal_uInt16 nInd = pGlueList->FindGluePoint(rConn0.GetConnectorId());
     524                 :            : 
     525         [ #  # ]:          0 :                                                         if(SDRGLUEPOINT_NOTFOUND != nInd)
     526                 :            :                                                         {
     527         [ #  # ]:          0 :                                                             const SdrGluePoint& rGluePoint = (*pGlueList)[nInd];
     528         [ #  # ]:          0 :                                                             Point aPosition = rGluePoint.GetAbsolutePos(*pConnObj);
     529                 :          0 :                                                             aPosition.X() += aVector.A();
     530                 :          0 :                                                             aPosition.Y() += aVector.B();
     531         [ #  # ]:          0 :                                                             pCloneEdge->SetTailPoint(sal_False, aPosition);
     532                 :            :                                                         }
     533                 :            :                                                     }
     534                 :            :                                                 }
     535                 :            :                                             }
     536                 :            : 
     537                 :            :                                             // test second connection
     538                 :          0 :                                             SdrObjConnection& rConn1 = pOrigEdge->GetConnection(sal_True);
     539                 :          0 :                                             pConnObj = rConn1.GetObject();
     540         [ #  # ]:          0 :                                             if(pConnObj)
     541                 :            :                                             {
     542         [ #  # ]:          0 :                                                 SdrObject* pConnClone = ImpGetClone(aConnectorContainer, pConnObj);
     543         [ #  # ]:          0 :                                                 if(pConnClone)
     544                 :            :                                                 {
     545                 :            :                                                     // if dest obj was cloned, too, re-establish connection
     546         [ #  # ]:          0 :                                                     pCloneEdge->ConnectToNode(sal_True, pConnClone);
     547                 :          0 :                                                     pCloneEdge->GetConnection(sal_True).SetConnectorId(rConn1.GetConnectorId());
     548                 :            :                                                 }
     549                 :            :                                                 else
     550                 :            :                                                 {
     551                 :            :                                                     // set position of connection point of original connected object
     552         [ #  # ]:          0 :                                                     const SdrGluePointList* pGlueList = pConnObj->GetGluePointList();
     553         [ #  # ]:          0 :                                                     if(pGlueList)
     554                 :            :                                                     {
     555         [ #  # ]:          0 :                                                         sal_uInt16 nInd = pGlueList->FindGluePoint(rConn1.GetConnectorId());
     556                 :            : 
     557         [ #  # ]:          0 :                                                         if(SDRGLUEPOINT_NOTFOUND != nInd)
     558                 :            :                                                         {
     559         [ #  # ]:          0 :                                                             const SdrGluePoint& rGluePoint = (*pGlueList)[nInd];
     560         [ #  # ]:          0 :                                                             Point aPosition = rGluePoint.GetAbsolutePos(*pConnObj);
     561                 :          0 :                                                             aPosition.X() += aVector.A();
     562                 :          0 :                                                             aPosition.Y() += aVector.B();
     563         [ #  # ]:          0 :                                                             pCloneEdge->SetTailPoint(sal_True, aPosition);
     564                 :            :                                                         }
     565                 :            :                                                     }
     566                 :            :                                                 }
     567                 :            :                                             }
     568                 :            :                                         }
     569                 :            :                                     }
     570                 :            :                                 }
     571                 :            : 
     572                 :            :                                 // cleanup remember classes
     573         [ #  # ]:          0 :                                 for(a = 0; a < aConnectorContainer.size(); a++)
     574                 :          0 :                                     delete aConnectorContainer[a];
     575                 :            : 
     576         [ #  # ]:          0 :                                 if( pMarkList != mpDragSrcMarkList )
     577 [ #  # ][ #  # ]:          0 :                                     delete pMarkList;
     578                 :            : 
     579                 :          0 :                                 bReturn = sal_True;
     580                 :            :                             }
     581                 :            :                             else
     582                 :            :                             {
     583         [ #  # ]:          0 :                                 maDropErrorTimer.Start();
     584                 :          0 :                                 bReturn = sal_False;
     585                 :            :                             }
     586         [ #  # ]:          0 :                         }
     587                 :            :                     }
     588                 :            :                     else
     589                 :            :                     {
     590                 :          0 :                         pOwnData->SetInternalMove( sal_True );
     591                 :          0 :                         MoveAllMarked( Size( maDropPos.X() - pOwnData->GetStartPos().X(),
     592         [ #  # ]:          0 :                                              maDropPos.Y() - pOwnData->GetStartPos().Y() ), bCopy );
     593                 :          0 :                         bReturn = sal_True;
     594                 :            :                     }
     595                 :            :                 }
     596                 :            :             }
     597                 :            :             else
     598                 :            :             {
     599                 :            :                 // different views
     600 [ #  # ][ #  # ]:          0 :                 if( !pSourceView->IsPresObjSelected() )
     601                 :            :                 {
     602                 :            :                     // model is owned by from AllocModel() created DocShell
     603                 :          0 :                     SdDrawDocument* pSourceDoc = (SdDrawDocument*) pSourceView->GetModel();
     604                 :          0 :                     pSourceDoc->CreatingDataObj( pOwnData );
     605         [ #  # ]:          0 :                     SdDrawDocument* pModel = (SdDrawDocument*) pSourceView->GetAllMarkedModel();
     606         [ #  # ]:          0 :                     bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
     607                 :            : 
     608         [ #  # ]:          0 :                     if( !pPage )
     609                 :          0 :                         pPage = (SdPage*) GetSdrPageView()->GetPage();
     610                 :            : 
     611         [ #  # ]:          0 :                     String aLayout( pPage->GetLayoutName() );
     612 [ #  # ][ #  # ]:          0 :                     aLayout.Erase( aLayout.SearchAscii( SD_LT_SEPARATOR ) );
     613         [ #  # ]:          0 :                     pPage->SetPresentationLayout( aLayout, sal_False, sal_False );
     614         [ #  # ]:          0 :                     pSourceDoc->CreatingDataObj( NULL );
     615                 :            :                 }
     616                 :            :                 else
     617                 :            :                 {
     618         [ #  # ]:          0 :                     maDropErrorTimer.Start();
     619                 :          0 :                     bReturn = sal_False;
     620                 :            :                 }
     621                 :            :             }
     622                 :            :         }
     623                 :            :         else
     624                 :            :         {
     625                 :          0 :             SdDrawDocument* pWorkModel = (SdDrawDocument*) pOwnData->GetWorkDocument();
     626         [ #  # ]:          0 :             SdPage*         pWorkPage = (SdPage*) pWorkModel->GetSdPage( 0, PK_STANDARD );
     627                 :            : 
     628         [ #  # ]:          0 :             pWorkPage->SetRectsDirty();
     629                 :            : 
     630                 :            :             // Use SnapRect, not BoundRect
     631 [ #  # ][ #  # ]:          0 :             Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
     632                 :            : 
     633                 :          0 :             maDropPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
     634                 :          0 :             maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
     635                 :            : 
     636                 :            :             // delete pages, that are not of any interest for us
     637 [ #  # ][ #  # ]:          0 :             for( long i = ( pWorkModel->GetPageCount() - 1 ); i >= 0; i-- )
     638                 :            :             {
     639         [ #  # ]:          0 :                 SdPage* pP = static_cast< SdPage* >( pWorkModel->GetPage( (sal_uInt16) i ) );
     640                 :            : 
     641         [ #  # ]:          0 :                 if( pP->GetPageKind() != PK_STANDARD )
     642         [ #  # ]:          0 :                     pWorkModel->DeletePage( (sal_uInt16) i );
     643                 :            :             }
     644                 :            : 
     645         [ #  # ]:          0 :             bReturn = Paste( *pWorkModel, maDropPos, pPage, nPasteOptions );
     646                 :            : 
     647         [ #  # ]:          0 :             if( !pPage )
     648                 :          0 :                 pPage = (SdPage*) GetSdrPageView()->GetPage();
     649                 :            : 
     650         [ #  # ]:          0 :             String aLayout(pPage->GetLayoutName());
     651 [ #  # ][ #  # ]:          0 :             aLayout.Erase(aLayout.SearchAscii(SD_LT_SEPARATOR));
     652 [ #  # ][ #  # ]:          0 :             pPage->SetPresentationLayout( aLayout, sal_False, sal_False );
     653                 :          0 :        }
     654                 :            :     }
     655 [ #  # ][ #  # ]:          0 :     else if( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_DRAWING ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     656                 :            :     {
     657                 :          0 :         SotStorageStreamRef xStm;
     658                 :            : 
     659 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStm ) )
     660                 :            :         {
     661                 :          0 :             sal_Bool bChanged = sal_False;
     662                 :            : 
     663 [ #  # ][ #  # ]:          0 :             DrawDocShellRef xShell = new DrawDocShell(SFX_CREATE_MODE_INTERNAL);
     664         [ #  # ]:          0 :             xShell->DoInitNew(0);
     665                 :            : 
     666         [ #  # ]:          0 :             SdDrawDocument* pModel = xShell->GetDoc();
     667 [ #  # ][ #  # ]:          0 :             pModel->InsertPage(pModel->AllocPage(false));
     668                 :            : 
     669 [ #  # ][ #  # ]:          0 :             Reference< XComponent > xComponent( xShell->GetModel(), UNO_QUERY );
     670         [ #  # ]:          0 :             xStm->Seek( 0 );
     671                 :            : 
     672 [ #  # ][ #  # ]:          0 :             com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm ) );
                 [ #  # ]
     673         [ #  # ]:          0 :             bReturn = SvxDrawingLayerImport( pModel, xInputStream, xComponent, "com.sun.star.comp.Impress.XMLOasisImporter" );
     674                 :            : 
     675 [ #  # ][ #  # ]:          0 :             if( pModel->GetPageCount() == 0 )
     676                 :            :             {
     677                 :            :                 OSL_FAIL("empty or invalid drawing xml document on clipboard!" );
     678                 :            :             }
     679                 :            :             else
     680                 :            :             {
     681         [ #  # ]:          0 :                 if( bReturn )
     682                 :            :                 {
     683 [ #  # ][ #  # ]:          0 :                     if( pModel->GetSdPage( 0, PK_STANDARD )->GetObjCount() == 1 )
                 [ #  # ]
     684                 :            :                     {
     685                 :            :                         // only one object
     686 [ #  # ][ #  # ]:          0 :                         SdrObject*      pObj = pModel->GetSdPage( 0, PK_STANDARD )->GetObj( 0 );
     687                 :          0 :                         SdrObject*      pPickObj2 = NULL;
     688                 :          0 :                         SdrPageView*    pPV = NULL;
     689         [ #  # ]:          0 :                         PickObj( rPos, getHitTolLog(), pPickObj2, pPV );
     690                 :            : 
     691 [ #  # ][ #  # ]:          0 :                         if( ( mnAction & DND_ACTION_MOVE ) && pPickObj2 && pObj )
                 [ #  # ]
     692                 :            :                         {
     693                 :            :                             // replace object
     694         [ #  # ]:          0 :                             SdrObject*  pNewObj = pObj->Clone();
     695         [ #  # ]:          0 :                             Rectangle   aPickObjRect( pPickObj2->GetCurrentBoundRect() );
     696         [ #  # ]:          0 :                             Size        aPickObjSize( aPickObjRect.GetSize() );
     697                 :          0 :                             Point       aVec( aPickObjRect.TopLeft() );
     698         [ #  # ]:          0 :                             Rectangle   aObjRect( pNewObj->GetCurrentBoundRect() );
     699         [ #  # ]:          0 :                             Size        aObjSize( aObjRect.GetSize() );
     700                 :            : 
     701         [ #  # ]:          0 :                             Fraction aScaleWidth( aPickObjSize.Width(), aObjSize.Width() );
     702         [ #  # ]:          0 :                             Fraction aScaleHeight( aPickObjSize.Height(), aObjSize.Height() );
     703         [ #  # ]:          0 :                             pNewObj->NbcResize( aObjRect.TopLeft(), aScaleWidth, aScaleHeight );
     704                 :            : 
     705                 :          0 :                             aVec -= aObjRect.TopLeft();
     706         [ #  # ]:          0 :                             pNewObj->NbcMove( Size( aVec.X(), aVec.Y() ) );
     707                 :            : 
     708         [ #  # ]:          0 :                             const bool bUndo = IsUndoEnabled();
     709                 :            : 
     710         [ #  # ]:          0 :                             if( bUndo )
     711 [ #  # ][ #  # ]:          0 :                                 BegUndo( String( SdResId(STR_UNDO_DRAGDROP ) ) );
         [ #  # ][ #  # ]
     712 [ #  # ][ #  # ]:          0 :                             pNewObj->NbcSetLayer( pPickObj->GetLayer() );
     713                 :          0 :                             SdrPage* pWorkPage = GetSdrPageView()->GetPage();
     714         [ #  # ]:          0 :                             pWorkPage->InsertObject( pNewObj );
     715         [ #  # ]:          0 :                             if( bUndo )
     716                 :            :                             {
     717 [ #  # ][ #  # ]:          0 :                                 AddUndo( mrDoc.GetSdrUndoFactory().CreateUndoNewObject( *pNewObj ) );
                 [ #  # ]
     718 [ #  # ][ #  # ]:          0 :                                 AddUndo( mrDoc.GetSdrUndoFactory().CreateUndoDeleteObject( *pPickObj2 ) );
                 [ #  # ]
     719                 :            :                             }
     720 [ #  # ][ #  # ]:          0 :                             pWorkPage->RemoveObject( pPickObj2->GetOrdNum() );
     721                 :            : 
     722         [ #  # ]:          0 :                             if( bUndo )
     723                 :            :                             {
     724         [ #  # ]:          0 :                                 EndUndo();
     725                 :            :                             }
     726                 :            :                             else
     727                 :            :                             {
     728         [ #  # ]:          0 :                                 SdrObject::Free(pPickObj2 );
     729                 :            :                             }
     730                 :          0 :                             bChanged = sal_True;
     731                 :          0 :                             mnAction = DND_ACTION_COPY;
     732                 :            :                         }
     733 [ #  # ][ #  # ]:          0 :                         else if( ( mnAction & DND_ACTION_LINK ) && pPickObj && pObj && !pPickObj->ISA( SdrGrafObj ) && !pPickObj->ISA( SdrOle2Obj ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     734                 :            :                         {
     735         [ #  # ]:          0 :                             SfxItemSet aSet( mrDoc.GetPool() );
     736                 :            : 
     737                 :            :                             // set new attributes to object
     738         [ #  # ]:          0 :                             const bool bUndo = IsUndoEnabled();
     739         [ #  # ]:          0 :                             if( bUndo )
     740                 :            :                             {
     741 [ #  # ][ #  # ]:          0 :                                 BegUndo( String( SdResId( STR_UNDO_DRAGDROP ) ) );
         [ #  # ][ #  # ]
     742 [ #  # ][ #  # ]:          0 :                                 AddUndo( mrDoc.GetSdrUndoFactory().CreateUndoAttrObject( *pPickObj ) );
                 [ #  # ]
     743                 :            :                             }
     744 [ #  # ][ #  # ]:          0 :                             aSet.Put( pObj->GetMergedItemSet() );
     745                 :            : 
     746                 :            :                             // Eckenradius soll nicht uebernommen werden.
     747                 :            :                             // In der Gallery stehen Farbverlauefe (Rechtecke)
     748                 :            :                             // welche den Eckenradius == 0 haben. Dieser soll
     749                 :            :                             // nicht auf das Objekt uebertragen werden.
     750         [ #  # ]:          0 :                             aSet.ClearItem( SDRATTR_ECKENRADIUS );
     751                 :            : 
     752         [ #  # ]:          0 :                             pPickObj->SetMergedItemSetAndBroadcast( aSet );
     753                 :            : 
     754 [ #  # ][ #  # ]:          0 :                             if( pPickObj->ISA( E3dObject ) && pObj->ISA( E3dObject ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     755                 :            :                             {
     756                 :            :                                 // Zusaetzlich 3D Attribute handeln
     757         [ #  # ]:          0 :                                 SfxItemSet aNewSet( mrDoc.GetPool(), SID_ATTR_3D_START, SID_ATTR_3D_END, 0 );
     758         [ #  # ]:          0 :                                 SfxItemSet aOldSet( mrDoc.GetPool(), SID_ATTR_3D_START, SID_ATTR_3D_END, 0 );
     759                 :            : 
     760 [ #  # ][ #  # ]:          0 :                                 aOldSet.Put(pPickObj->GetMergedItemSet());
     761 [ #  # ][ #  # ]:          0 :                                 aNewSet.Put( pObj->GetMergedItemSet() );
     762                 :            : 
     763         [ #  # ]:          0 :                                 if( bUndo )
     764 [ #  # ][ #  # ]:          0 :                                     AddUndo( new E3dAttributesUndoAction( mrDoc, (E3dObject*) pPickObj, aNewSet, aOldSet ) );
                 [ #  # ]
     765 [ #  # ][ #  # ]:          0 :                                 pPickObj->SetMergedItemSetAndBroadcast( aNewSet );
                 [ #  # ]
     766                 :            :                             }
     767                 :            : 
     768         [ #  # ]:          0 :                             if( bUndo )
     769         [ #  # ]:          0 :                                 EndUndo();
     770         [ #  # ]:          0 :                             bChanged = sal_True;
     771                 :            :                         }
     772                 :            :                     }
     773                 :            :                 }
     774                 :            : 
     775         [ #  # ]:          0 :                 if( !bChanged )
     776                 :            :                 {
     777         [ #  # ]:          0 :                     SdrPage* pWorkPage = pModel->GetSdPage( 0, PK_STANDARD );
     778                 :            : 
     779         [ #  # ]:          0 :                     pWorkPage->SetRectsDirty();
     780                 :            : 
     781         [ #  # ]:          0 :                     if( pOwnData )
     782                 :            :                     {
     783                 :            :                         // Use SnapRect, not BoundRect
     784 [ #  # ][ #  # ]:          0 :                         Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
     785                 :            : 
     786                 :          0 :                         maDropPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
     787                 :          0 :                         maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
     788                 :            :                     }
     789                 :            : 
     790         [ #  # ]:          0 :                     bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
     791                 :            :                 }
     792                 :            : 
     793         [ #  # ]:          0 :                 xShell->DoClose();
     794         [ #  # ]:          0 :             }
     795         [ #  # ]:          0 :         }
     796                 :            :     }
     797 [ #  # ][ #  # ]:          0 :     else if( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     798                 :            :     {
     799                 :          0 :         ::rtl::OUString aOUString;
     800                 :            : 
     801 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetString( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, aOUString ) )
     802                 :            :         {
     803 [ #  # ][ #  # ]:          0 :             SdrObject* pObj = CreateFieldControl( aOUString );
                 [ #  # ]
     804                 :            : 
     805         [ #  # ]:          0 :             if( pObj )
     806                 :            :             {
     807         [ #  # ]:          0 :                 Rectangle   aRect( pObj->GetLogicRect() );
     808         [ #  # ]:          0 :                 Size        aSize( aRect.GetSize() );
     809                 :            : 
     810                 :          0 :                 maDropPos.X() -= ( aSize.Width() >> 1 );
     811                 :          0 :                 maDropPos.Y() -= ( aSize.Height() >> 1 );
     812                 :            : 
     813                 :          0 :                 aRect.SetPos( maDropPos );
     814         [ #  # ]:          0 :                 pObj->SetLogicRect( aRect );
     815         [ #  # ]:          0 :                 InsertObjectAtView( pObj, *GetSdrPageView(), SDRINSERT_SETDEFLAYER );
     816                 :          0 :                 bReturn = sal_True;
     817                 :            :             }
     818                 :          0 :         }
     819                 :            :     }
     820 [ #  # ][ #  # ]:          0 :     else if( !bLink &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     821         [ #  # ]:          0 :              ( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBED_SOURCE ) ||
     822         [ #  # ]:          0 :                CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBEDDED_OBJ ) )  &&
     823         [ #  # ]:          0 :                aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
     824                 :            :     {
     825                 :            :         //TODO/LATER: is it possible that this format is binary?! (from old versions of SO)
     826                 :          0 :         uno::Reference < io::XInputStream > xStm;
     827         [ #  # ]:          0 :         TransferableObjectDescriptor    aObjDesc;
     828                 :            : 
     829 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) &&
         [ #  # ][ #  # ]
                 [ #  # ]
     830 [ #  # ][ #  # ]:          0 :             ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, xStm ) ||
     831         [ #  # ]:          0 :               aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ, xStm ) ) )
     832                 :            :         {
     833 [ #  # ][ #  # ]:          0 :             if( mrDoc.GetDocSh() && ( mrDoc.GetDocSh()->GetClassName() == aObjDesc.maClassName ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     834                 :            :             {
     835         [ #  # ]:          0 :                 uno::Reference < embed::XStorage > xStore( ::comphelper::OStorageHelper::GetStorageFromInputStream( xStm ) );
     836 [ #  # ][ #  # ]:          0 :                 ::sd::DrawDocShellRef xDocShRef( new ::sd::DrawDocShell( SFX_CREATE_MODE_EMBEDDED, sal_True, mrDoc.GetDocumentType() ) );
     837                 :            : 
     838                 :            :                 // mba: BaseURL doesn't make sense for clipboard functionality
     839 [ #  # ][ #  # ]:          0 :                 SfxMedium *pMedium = new SfxMedium( xStore, String() );
         [ #  # ][ #  # ]
     840 [ #  # ][ #  # ]:          0 :                 if( xDocShRef->DoLoad( pMedium ) )
     841                 :            :                 {
     842         [ #  # ]:          0 :                     SdDrawDocument* pModel = (SdDrawDocument*) xDocShRef->GetDoc();
     843         [ #  # ]:          0 :                     SdPage*         pWorkPage = (SdPage*) pModel->GetSdPage( 0, PK_STANDARD );
     844                 :            : 
     845         [ #  # ]:          0 :                     pWorkPage->SetRectsDirty();
     846                 :            : 
     847         [ #  # ]:          0 :                     if( pOwnData )
     848                 :            :                     {
     849                 :            :                         // Use SnapRect, not BoundRect
     850 [ #  # ][ #  # ]:          0 :                         Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
     851                 :            : 
     852                 :          0 :                         maDropPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
     853                 :          0 :                         maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
     854                 :            :                     }
     855                 :            : 
     856                 :            :                     // delete pages, that are not of any interest for us
     857 [ #  # ][ #  # ]:          0 :                     for( long i = ( pModel->GetPageCount() - 1 ); i >= 0; i-- )
     858                 :            :                     {
     859         [ #  # ]:          0 :                         SdPage* pP = static_cast< SdPage* >( pModel->GetPage( (sal_uInt16) i ) );
     860                 :            : 
     861         [ #  # ]:          0 :                         if( pP->GetPageKind() != PK_STANDARD )
     862         [ #  # ]:          0 :                             pModel->DeletePage( (sal_uInt16) i );
     863                 :            :                     }
     864                 :            : 
     865         [ #  # ]:          0 :                     bReturn = Paste( *pModel, maDropPos, pPage, nPasteOptions );
     866                 :            : 
     867         [ #  # ]:          0 :                     if( !pPage )
     868                 :          0 :                         pPage = (SdPage*) GetSdrPageView()->GetPage();
     869                 :            : 
     870         [ #  # ]:          0 :                     String aLayout(pPage->GetLayoutName());
     871 [ #  # ][ #  # ]:          0 :                     aLayout.Erase(aLayout.SearchAscii(SD_LT_SEPARATOR));
     872 [ #  # ][ #  # ]:          0 :                     pPage->SetPresentationLayout( aLayout, sal_False, sal_False );
     873                 :            :                 }
     874                 :            : 
     875         [ #  # ]:          0 :                 xDocShRef->DoClose();
     876 [ #  # ][ #  # ]:          0 :                 xDocShRef.Clear();
     877                 :            : 
     878                 :            :             }
     879                 :            :             else
     880                 :            :             {
     881                 :          0 :                 ::rtl::OUString aName;
     882 [ #  # ][ #  # ]:          0 :                 uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
     883         [ #  # ]:          0 :                 if ( xObj.is() )
     884                 :            :                 {
     885         [ #  # ]:          0 :                     svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );
     886                 :            : 
     887                 :            :                     // try to get the replacement image from the clipboard
     888         [ #  # ]:          0 :                     Graphic aGraphic;
     889                 :          0 :                     sal_uLong nGrFormat = 0;
     890                 :            : 
     891                 :            : 
     892                 :            :                     // insert replacement image ( if there is one ) into the object helper
     893         [ #  # ]:          0 :                     if ( nGrFormat )
     894                 :            :                     {
     895                 :          0 :                         datatransfer::DataFlavor aDataFlavor;
     896         [ #  # ]:          0 :                         SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
     897         [ #  # ]:          0 :                         aObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
     898                 :            :                     }
     899                 :            : 
     900                 :          0 :                     Size aSize;
     901         [ #  # ]:          0 :                     if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
     902                 :            :                     {
     903 [ #  # ][ #  # ]:          0 :                         if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
                 [ #  # ]
     904                 :          0 :                             aSize = aObjDesc.maSize;
     905                 :            :                         else
     906                 :            :                         {
     907         [ #  # ]:          0 :                             MapMode aMapMode( MAP_100TH_MM );
     908 [ #  # ][ #  # ]:          0 :                             aSize = aObjRef.GetSize( &aMapMode );
     909                 :            :                         }
     910                 :            :                     }
     911                 :            :                     else
     912                 :            :                     {
     913                 :          0 :                         awt::Size aSz;
     914 [ #  # ][ #  # ]:          0 :                         MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
                 [ #  # ]
     915 [ #  # ][ #  # ]:          0 :                         if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
                 [ #  # ]
     916                 :            :                         {
     917 [ #  # ][ #  # ]:          0 :                             Size aTmp( OutputDevice::LogicToLogic( aObjDesc.maSize, MAP_100TH_MM, aMapUnit ) );
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     918                 :          0 :                             aSz.Width = aTmp.Width();
     919                 :          0 :                             aSz.Height = aTmp.Height();
     920 [ #  # ][ #  # ]:          0 :                             xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
     921                 :            :                         }
     922                 :            : 
     923                 :            :                         try
     924                 :            :                         {
     925 [ #  # ][ #  # ]:          0 :                             aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
     926                 :            :                         }
     927         [ #  # ]:          0 :                         catch( embed::NoVisualAreaSizeException& )
     928                 :            :                         {
     929                 :            :                             // if the size still was not set the default size will be set later
     930                 :            :                         }
     931                 :            : 
     932                 :          0 :                         aSize = Size( aSz.Width, aSz.Height );
     933                 :            : 
     934 [ #  # ][ #  # ]:          0 :                         if( !aSize.Width() || !aSize.Height() )
                 [ #  # ]
     935                 :            :                         {
     936                 :          0 :                             aSize.Width()  = 14100;
     937                 :          0 :                             aSize.Height() = 10000;
     938 [ #  # ][ #  # ]:          0 :                             aSize = OutputDevice::LogicToLogic( Size(14100, 10000), MAP_100TH_MM, aMapUnit );
         [ #  # ][ #  # ]
                 [ #  # ]
     939                 :          0 :                             aSz.Width = aSize.Width();
     940                 :          0 :                             aSz.Height = aSize.Height();
     941 [ #  # ][ #  # ]:          0 :                             xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
     942                 :            :                         }
     943                 :            : 
     944 [ #  # ][ #  # ]:          0 :                         aSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MAP_100TH_MM );
         [ #  # ][ #  # ]
                 [ #  # ]
     945                 :            :                     }
     946                 :            : 
     947                 :          0 :                     Size aMaxSize( mrDoc.GetMaxObjSize() );
     948                 :            : 
     949                 :          0 :                     maDropPos.X() -= Min( aSize.Width(), aMaxSize.Width() ) >> 1;
     950                 :          0 :                     maDropPos.Y() -= Min( aSize.Height(), aMaxSize.Height() ) >> 1;
     951                 :            : 
     952         [ #  # ]:          0 :                     Rectangle       aRect( maDropPos, aSize );
     953 [ #  # ][ #  # ]:          0 :                     SdrOle2Obj*     pObj = new SdrOle2Obj( aObjRef, aName, aRect );
         [ #  # ][ #  # ]
     954                 :          0 :                     SdrPageView*    pPV = GetSdrPageView();
     955                 :          0 :                     sal_uLong           nOptions = SDRINSERT_SETDEFLAYER;
     956                 :            : 
     957         [ #  # ]:          0 :                     if (mpViewSh!=NULL)
     958                 :            :                     {
     959                 :            :                         OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
     960                 :            :                         SfxInPlaceClient* pIpClient
     961 [ #  # ][ #  # ]:          0 :                             = mpViewSh->GetViewShell()->GetIPClient();
     962 [ #  # ][ #  # ]:          0 :                         if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
         [ #  # ][ #  # ]
     963                 :          0 :                             nOptions |= SDRINSERT_DONTMARK;
     964                 :            :                     }
     965                 :            : 
     966         [ #  # ]:          0 :                     InsertObjectAtView( pObj, *pPV, nOptions );
     967                 :            : 
     968         [ #  # ]:          0 :                     if( pImageMap )
     969 [ #  # ][ #  # ]:          0 :                         pObj->AppendUserData( new SdIMapInfo( *pImageMap ) );
                 [ #  # ]
     970                 :            : 
     971 [ #  # ][ #  # ]:          0 :                     if ( pObj && pObj->IsChart() )
         [ #  # ][ #  # ]
     972                 :            :                     {
     973                 :          0 :                         bool bDisableDataTableDialog = false;
     974         [ #  # ]:          0 :                         svt::EmbeddedObjectRef::TryRunningState( xObj );
     975 [ #  # ][ #  # ]:          0 :                         uno::Reference< beans::XPropertySet > xProps( xObj->getComponent(), uno::UNO_QUERY );
                 [ #  # ]
     976 [ #  # ][ #  # ]:          0 :                         if ( xProps.is() &&
           [ #  #  #  # ]
     977 [ #  # ][ #  # ]:          0 :                              ( xProps->getPropertyValue( "DisableDataTableDialog" ) >>= bDisableDataTableDialog ) &&
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
     978                 :            :                              bDisableDataTableDialog )
     979                 :            :                         {
     980 [ #  # ][ #  # ]:          0 :                             xProps->setPropertyValue( "DisableDataTableDialog" , uno::makeAny( sal_False ) );
                 [ #  # ]
     981 [ #  # ][ #  # ]:          0 :                             xProps->setPropertyValue( "DisableComplexChartTypes" , uno::makeAny( sal_False ) );
                 [ #  # ]
     982         [ #  # ]:          0 :                             uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY );
     983         [ #  # ]:          0 :                             if ( xModifiable.is() )
     984                 :            :                             {
     985 [ #  # ][ #  # ]:          0 :                                 xModifiable->setModified( sal_True );
     986                 :          0 :                             }
     987                 :          0 :                         }
     988                 :            :                     }
     989                 :            : 
     990 [ #  # ][ #  # ]:          0 :                     bReturn = sal_True;
     991                 :          0 :                 }
     992                 :            :             }
     993         [ #  # ]:          0 :         }
     994                 :            :     }
     995 [ #  # ][ #  # ]:          0 :     else if( !bLink &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     996         [ #  # ]:          0 :              ( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ) ||
     997         [ #  # ]:          0 :                CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ) ) &&
     998         [ #  # ]:          0 :                aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ) )
     999                 :            :     {
    1000                 :            :         // online insert ole if format is forced or no gdi metafile is available
    1001 [ #  # ][ #  # ]:          0 :         if( (nFormat != 0) || !aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) )
         [ #  # ][ #  # ]
    1002                 :            :         {
    1003                 :          0 :             uno::Reference < io::XInputStream > xStm;
    1004         [ #  # ]:          0 :             TransferableObjectDescriptor    aObjDesc;
    1005                 :            : 
    1006 [ #  # ][ #  # ]:          0 :             if ( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE, aObjDesc ) )
    1007                 :            :             {
    1008                 :          0 :                 uno::Reference < embed::XEmbeddedObject > xObj;
    1009                 :          0 :                 ::rtl::OUString aName;
    1010                 :            : 
    1011 [ #  # ][ #  # ]:          0 :                 if ( aDataHelper.GetInputStream( nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStm ) ||
         [ #  # ][ #  # ]
                 [ #  # ]
    1012         [ #  # ]:          0 :                     aDataHelper.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStm ) )
    1013                 :            :                 {
    1014 [ #  # ][ #  # ]:          0 :                     xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
                 [ #  # ]
    1015                 :            :                 }
    1016                 :            :                 else
    1017                 :            :                 {
    1018                 :            :                     try
    1019                 :            :                     {
    1020         [ #  # ]:          0 :                         uno::Reference< embed::XStorage > xTmpStor = ::comphelper::OStorageHelper::GetTemporaryStorage();
    1021                 :            :                         uno::Reference < embed::XEmbedObjectClipboardCreator > xClipboardCreator(
    1022 [ #  # ][ #  # ]:          0 :                             ::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.embed.MSOLEObjectSystemCreator"),
    1023 [ #  # ][ #  # ]:          0 :                             uno::UNO_QUERY_THROW );
    1024                 :            : 
    1025         [ #  # ]:          0 :                         embed::InsertedObjectInfo aInfo = xClipboardCreator->createInstanceInitFromClipboard(
    1026                 :            :                                                                 xTmpStor,
    1027                 :            :                                                                 "DummyName" ,
    1028 [ #  # ][ #  # ]:          0 :                                                                 uno::Sequence< beans::PropertyValue >() );
                 [ #  # ]
    1029                 :            : 
    1030                 :            :                         // TODO/LATER: in future InsertedObjectInfo will be used to get container related information
    1031                 :            :                         // for example whether the object should be an iconified one
    1032         [ #  # ]:          0 :                         xObj = aInfo.Object;
    1033         [ #  # ]:          0 :                         if ( xObj.is() )
    1034 [ #  # ][ #  # ]:          0 :                             mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName );
         [ #  # ][ #  # ]
    1035                 :            :                     }
    1036         [ #  # ]:          0 :                     catch( uno::Exception& )
    1037                 :            :                     {}
    1038                 :            :                 }
    1039                 :            : 
    1040         [ #  # ]:          0 :                 if ( xObj.is() )
    1041                 :            :                 {
    1042         [ #  # ]:          0 :                     svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );
    1043                 :            : 
    1044                 :            :                     // try to get the replacement image from the clipboard
    1045         [ #  # ]:          0 :                     Graphic aGraphic;
    1046                 :          0 :                     sal_uLong nGrFormat = 0;
    1047                 :            : 
    1048                 :            : // (wg. Selection Manager bei Trustet Solaris)
    1049                 :            : #ifndef SOLARIS
    1050 [ #  # ][ #  # ]:          0 :                     if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
    1051                 :          0 :                         nGrFormat = SOT_FORMATSTR_ID_SVXB;
    1052 [ #  # ][ #  # ]:          0 :                     else if( aDataHelper.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
    1053                 :          0 :                         nGrFormat = SOT_FORMAT_GDIMETAFILE;
    1054 [ #  # ][ #  # ]:          0 :                     else if( aDataHelper.GetGraphic( FORMAT_BITMAP, aGraphic ) )
    1055                 :          0 :                         nGrFormat = SOT_FORMAT_BITMAP;
    1056                 :            : #endif
    1057                 :            : 
    1058                 :            :                     // insert replacement image ( if there is one ) into the object helper
    1059         [ #  # ]:          0 :                     if ( nGrFormat )
    1060                 :            :                     {
    1061                 :          0 :                         datatransfer::DataFlavor aDataFlavor;
    1062         [ #  # ]:          0 :                         SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
    1063         [ #  # ]:          0 :                         aObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
    1064                 :            :                     }
    1065                 :            : 
    1066                 :          0 :                     Size aSize;
    1067         [ #  # ]:          0 :                     if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
    1068                 :            :                     {
    1069 [ #  # ][ #  # ]:          0 :                         if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
                 [ #  # ]
    1070                 :          0 :                             aSize = aObjDesc.maSize;
    1071                 :            :                         else
    1072                 :            :                         {
    1073         [ #  # ]:          0 :                             MapMode aMapMode( MAP_100TH_MM );
    1074 [ #  # ][ #  # ]:          0 :                             aSize = aObjRef.GetSize( &aMapMode );
                 [ #  # ]
    1075                 :            :                         }
    1076                 :            :                     }
    1077                 :            :                     else
    1078                 :            :                     {
    1079 [ #  # ][ #  # ]:          0 :                         MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
                 [ #  # ]
    1080                 :            : 
    1081                 :          0 :                         awt::Size aSz;
    1082                 :            :                         try{
    1083 [ #  # ][ #  # ]:          0 :                             aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
    1084                 :            :                         }
    1085         [ #  # ]:          0 :                         catch( embed::NoVisualAreaSizeException& )
    1086                 :            :                         {
    1087                 :            :                             // the default size will be set later
    1088                 :            :                         }
    1089                 :            : 
    1090 [ #  # ][ #  # ]:          0 :                         if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
                 [ #  # ]
    1091                 :            :                         {
    1092 [ #  # ][ #  # ]:          0 :                             Size aTmp( OutputDevice::LogicToLogic( aObjDesc.maSize, MAP_100TH_MM, aMapUnit ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1093 [ #  # ][ #  # ]:          0 :                             if ( aSz.Width != aTmp.Width() || aSz.Height != aTmp.Height() )
                 [ #  # ]
    1094                 :            :                             {
    1095                 :          0 :                                 aSz.Width = aTmp.Width();
    1096                 :          0 :                                 aSz.Height = aTmp.Height();
    1097 [ #  # ][ #  # ]:          0 :                                 xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
    1098                 :            :                             }
    1099                 :            :                         }
    1100                 :            : 
    1101                 :          0 :                         aSize = Size( aSz.Width, aSz.Height );
    1102                 :            : 
    1103 [ #  # ][ #  # ]:          0 :                         if( !aSize.Width() || !aSize.Height() )
                 [ #  # ]
    1104                 :            :                         {
    1105 [ #  # ][ #  # ]:          0 :                             aSize = OutputDevice::LogicToLogic( Size(14100, 10000), MAP_100TH_MM, aMapUnit );
         [ #  # ][ #  # ]
                 [ #  # ]
    1106                 :          0 :                             aSz.Width = aSize.Width();
    1107                 :          0 :                             aSz.Height = aSize.Height();
    1108 [ #  # ][ #  # ]:          0 :                             xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
    1109                 :            :                         }
    1110                 :            : 
    1111 [ #  # ][ #  # ]:          0 :                         aSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MAP_100TH_MM );
         [ #  # ][ #  # ]
                 [ #  # ]
    1112                 :            :                     }
    1113                 :            : 
    1114                 :          0 :                     Size aMaxSize( mrDoc.GetMaxObjSize() );
    1115                 :            : 
    1116                 :          0 :                     maDropPos.X() -= Min( aSize.Width(), aMaxSize.Width() ) >> 1;
    1117                 :          0 :                     maDropPos.Y() -= Min( aSize.Height(), aMaxSize.Height() ) >> 1;
    1118                 :            : 
    1119         [ #  # ]:          0 :                     Rectangle       aRect( maDropPos, aSize );
    1120 [ #  # ][ #  # ]:          0 :                     SdrOle2Obj*     pObj = new SdrOle2Obj( aObjRef, aName, aRect );
         [ #  # ][ #  # ]
    1121                 :          0 :                     SdrPageView*    pPV = GetSdrPageView();
    1122                 :          0 :                     sal_uLong           nOptions = SDRINSERT_SETDEFLAYER;
    1123                 :            : 
    1124         [ #  # ]:          0 :                     if (mpViewSh!=NULL)
    1125                 :            :                     {
    1126                 :            :                         OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
    1127                 :            :                         SfxInPlaceClient* pIpClient
    1128 [ #  # ][ #  # ]:          0 :                             = mpViewSh->GetViewShell()->GetIPClient();
    1129 [ #  # ][ #  # ]:          0 :                         if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
         [ #  # ][ #  # ]
    1130                 :          0 :                             nOptions |= SDRINSERT_DONTMARK;
    1131                 :            :                     }
    1132                 :            : 
    1133         [ #  # ]:          0 :                     InsertObjectAtView( pObj, *pPV, nOptions );
    1134                 :            : 
    1135         [ #  # ]:          0 :                     if( pImageMap )
    1136 [ #  # ][ #  # ]:          0 :                         pObj->AppendUserData( new SdIMapInfo( *pImageMap ) );
                 [ #  # ]
    1137                 :            : 
    1138                 :            :                     // let the object stay in loaded state after insertion
    1139         [ #  # ]:          0 :                     pObj->Unload();
    1140 [ #  # ][ #  # ]:          0 :                     bReturn = sal_True;
    1141                 :          0 :                 }
    1142         [ #  # ]:          0 :             }
    1143                 :            :         }
    1144                 :            : 
    1145 [ #  # ][ #  # ]:          0 :         if( !bReturn && aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) )
         [ #  # ][ #  # ]
    1146                 :            :         {
    1147                 :            :             // if no object was inserted, insert a picture
    1148         [ #  # ]:          0 :             InsertMetaFile( aDataHelper, rPos, pImageMap, true );
    1149                 :            :         }
    1150                 :            :     }
    1151 [ #  # ][ #  # ]:          0 :     else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_SVXB ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1152                 :            :     {
    1153                 :          0 :         SotStorageStreamRef xStm;
    1154                 :            : 
    1155 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_SVXB, xStm ) )
    1156                 :            :         {
    1157                 :          0 :             Point   aInsertPos( rPos );
    1158         [ #  # ]:          0 :             Graphic aGraphic;
    1159                 :            : 
    1160         [ #  # ]:          0 :             *xStm >> aGraphic;
    1161                 :            : 
    1162 [ #  # ][ #  # ]:          0 :             if( pOwnData && pOwnData->GetWorkDocument() )
                 [ #  # ]
    1163                 :            :             {
    1164                 :          0 :                 const SdDrawDocument*   pWorkModel = pOwnData->GetWorkDocument();
    1165         [ #  # ]:          0 :                 SdrPage*                pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ?
    1166                 :            :                                                     pWorkModel->GetSdPage( 0, PK_STANDARD ) :
    1167 [ #  # ][ #  # ]:          0 :                                                     pWorkModel->GetPage( 0 ) );
                 [ #  # ]
    1168                 :            : 
    1169         [ #  # ]:          0 :                 pWorkPage->SetRectsDirty();
    1170                 :            : 
    1171                 :            :                 // Use SnapRect, not BoundRect
    1172 [ #  # ][ #  # ]:          0 :                 Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
    1173                 :            : 
    1174                 :          0 :                 aInsertPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
    1175                 :          0 :                 aInsertPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
    1176                 :            :             }
    1177                 :            : 
    1178                 :            :             // restrict movement to WorkArea
    1179                 :            :             Size aImageMapSize = OutputDevice::LogicToLogic(aGraphic.GetPrefSize(),
    1180 [ #  # ][ #  # ]:          0 :                 aGraphic.GetPrefMapMode(), MapMode(MAP_100TH_MM));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1181                 :            : 
    1182         [ #  # ]:          0 :             ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea());
    1183                 :            : 
    1184         [ #  # ]:          0 :             InsertGraphic( aGraphic, mnAction, aInsertPos, NULL, pImageMap );
    1185         [ #  # ]:          0 :             bReturn = sal_True;
    1186         [ #  # ]:          0 :         }
    1187                 :            :     }
    1188 [ #  # ][ #  # ]:          0 :     else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( FORMAT_GDIMETAFILE ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1189                 :            :     {
    1190                 :          0 :         Point aInsertPos( rPos );
    1191                 :            : 
    1192 [ #  # ][ #  # ]:          0 :         if( pOwnData && pOwnData->GetWorkDocument() )
                 [ #  # ]
    1193                 :            : 
    1194                 :            :         {
    1195                 :          0 :             const SdDrawDocument*   pWorkModel = pOwnData->GetWorkDocument();
    1196         [ #  # ]:          0 :             SdrPage*                pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ?
    1197                 :            :                                                 pWorkModel->GetSdPage( 0, PK_STANDARD ) :
    1198 [ #  # ][ #  # ]:          0 :                                                 pWorkModel->GetPage( 0 ) );
                 [ #  # ]
    1199                 :            : 
    1200         [ #  # ]:          0 :             pWorkPage->SetRectsDirty();
    1201                 :            : 
    1202                 :            :             // Use SnapRect, not BoundRect
    1203 [ #  # ][ #  # ]:          0 :             Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
    1204                 :            : 
    1205                 :          0 :             aInsertPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
    1206                 :          0 :             aInsertPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
    1207                 :            :         }
    1208                 :            : 
    1209 [ #  # ][ #  # ]:          0 :         bReturn = InsertMetaFile( aDataHelper, aInsertPos, pImageMap, nFormat == 0 ? true : false ) ? sal_True : sal_False;
    1210                 :            :     }
    1211 [ #  # ][ #  # ]:          0 :     else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( FORMAT_BITMAP ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1212                 :            :     {
    1213         [ #  # ]:          0 :         Bitmap aBmp;
    1214                 :            : 
    1215 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetBitmap( FORMAT_BITMAP, aBmp ) )
    1216                 :            :         {
    1217                 :          0 :             Point aInsertPos( rPos );
    1218                 :            : 
    1219 [ #  # ][ #  # ]:          0 :             if( pOwnData && pOwnData->GetWorkDocument() )
                 [ #  # ]
    1220                 :            :             {
    1221                 :          0 :                 const SdDrawDocument*   pWorkModel = pOwnData->GetWorkDocument();
    1222         [ #  # ]:          0 :                 SdrPage*                pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ?
    1223                 :            :                                                     pWorkModel->GetSdPage( 0, PK_STANDARD ) :
    1224 [ #  # ][ #  # ]:          0 :                                                     pWorkModel->GetPage( 0 ) );
                 [ #  # ]
    1225                 :            : 
    1226         [ #  # ]:          0 :                 pWorkPage->SetRectsDirty();
    1227                 :            : 
    1228                 :            :                 // Use SnapRect, not BoundRect
    1229 [ #  # ][ #  # ]:          0 :                 Size aSize( pWorkPage->GetAllObjSnapRect().GetSize() );
    1230                 :            : 
    1231                 :          0 :                 aInsertPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
    1232                 :          0 :                 aInsertPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
    1233                 :            :             }
    1234                 :            : 
    1235                 :            :             // restrict movement to WorkArea
    1236                 :          0 :             Size aImageMapSize(aBmp.GetPrefSize());
    1237         [ #  # ]:          0 :             ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea());
    1238                 :            : 
    1239 [ #  # ][ #  # ]:          0 :             InsertGraphic( aBmp, mnAction, aInsertPos, NULL, pImageMap );
                 [ #  # ]
    1240                 :          0 :             bReturn = sal_True;
    1241         [ #  # ]:          0 :         }
    1242                 :            :     }
    1243 [ #  # ][ #  # ]:          0 :     else if( pPickObj && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_XFA ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1244                 :            :     {
    1245                 :          0 :         SotStorageStreamRef xStm;
    1246                 :            : 
    1247 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_XFA, xStm ) )
    1248                 :            :         {
    1249 [ #  # ][ #  # ]:          0 :             XFillExchangeData aFillData( XFillAttrSetItem( &mrDoc.GetPool() ) );
                 [ #  # ]
    1250                 :            : 
    1251         [ #  # ]:          0 :             *xStm >> aFillData;
    1252                 :            : 
    1253 [ #  # ][ #  # ]:          0 :             if( IsUndoEnabled() )
    1254                 :            :             {
    1255 [ #  # ][ #  # ]:          0 :                 BegUndo( String( SdResId( STR_UNDO_DRAGDROP ) ) );
         [ #  # ][ #  # ]
    1256 [ #  # ][ #  # ]:          0 :                 AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pPickObj ) );
                 [ #  # ]
    1257         [ #  # ]:          0 :                 EndUndo();
    1258                 :            :             }
    1259                 :            : 
    1260                 :          0 :             XFillAttrSetItem*   pSetItem = aFillData.GetXFillAttrSetItem();
    1261         [ #  # ]:          0 :             SfxItemSet          rSet = pSetItem->GetItemSet();
    1262         [ #  # ]:          0 :             XFillStyle          eFill= ( (XFillStyleItem&) rSet.Get( XATTR_FILLSTYLE ) ).GetValue();
    1263                 :            : 
    1264 [ #  # ][ #  # ]:          0 :             if( eFill == XFILL_SOLID || eFill == XFILL_NONE )
    1265                 :            :             {
    1266         [ #  # ]:          0 :                 const XFillColorItem&   rColItem = (XFillColorItem&) rSet.Get( XATTR_FILLCOLOR );
    1267         [ #  # ]:          0 :                 Color                   aColor( rColItem.GetColorValue() );
    1268         [ #  # ]:          0 :                 String                  aName( rColItem.GetName() );
    1269         [ #  # ]:          0 :                 SfxItemSet              aSet( mrDoc.GetPool() );
    1270         [ #  # ]:          0 :                 sal_Bool                    bClosed = pPickObj->IsClosedObj();
    1271         [ #  # ]:          0 :                 ::sd::Window* pWin = mpViewSh->GetActiveWindow();
    1272                 :            :                 sal_uInt16 nHitLog = (sal_uInt16) pWin->PixelToLogic(
    1273         [ #  # ]:          0 :                     Size(FuPoor::HITPIX, 0 ) ).Width();
    1274                 :          0 :                 const long              n2HitLog = nHitLog << 1;
    1275                 :          0 :                 Point                   aHitPosR( rPos );
    1276                 :          0 :                 Point                   aHitPosL( rPos );
    1277                 :          0 :                 Point                   aHitPosT( rPos );
    1278                 :          0 :                 Point                   aHitPosB( rPos );
    1279                 :          0 :                 const SetOfByte*        pVisiLayer = &GetSdrPageView()->GetVisibleLayers();
    1280                 :            : 
    1281                 :          0 :                 aHitPosR.X() += n2HitLog;
    1282                 :          0 :                 aHitPosL.X() -= n2HitLog;
    1283                 :          0 :                 aHitPosT.Y() += n2HitLog;
    1284                 :          0 :                 aHitPosB.Y() -= n2HitLog;
    1285                 :            : 
    1286 [ #  # ][ #  # ]:          0 :                 if( bClosed &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1287         [ #  # ]:          0 :                     SdrObjectPrimitiveHit(*pPickObj, aHitPosR, nHitLog, *GetSdrPageView(), pVisiLayer, false) &&
    1288         [ #  # ]:          0 :                     SdrObjectPrimitiveHit(*pPickObj, aHitPosL, nHitLog, *GetSdrPageView(), pVisiLayer, false) &&
    1289         [ #  # ]:          0 :                     SdrObjectPrimitiveHit(*pPickObj, aHitPosT, nHitLog, *GetSdrPageView(), pVisiLayer, false) &&
    1290         [ #  # ]:          0 :                     SdrObjectPrimitiveHit(*pPickObj, aHitPosB, nHitLog, *GetSdrPageView(), pVisiLayer, false) )
    1291                 :            :                 {
    1292                 :            :                     // area fill
    1293         [ #  # ]:          0 :                     if(eFill == XFILL_SOLID )
    1294 [ #  # ][ #  # ]:          0 :                         aSet.Put(XFillColorItem(aName, aColor));
                 [ #  # ]
    1295                 :            : 
    1296 [ #  # ][ #  # ]:          0 :                     aSet.Put( XFillStyleItem( eFill ) );
                 [ #  # ]
    1297                 :            :                 }
    1298                 :            :                 else
    1299 [ #  # ][ #  # ]:          0 :                     aSet.Put( XLineColorItem( aName, aColor ) );
                 [ #  # ]
    1300                 :            : 
    1301                 :            :                 // Textfarbe hinzufuegen
    1302 [ #  # ][ #  # ]:          0 :                 pPickObj->SetMergedItemSetAndBroadcast( aSet );
                 [ #  # ]
    1303 [ #  # ][ #  # ]:          0 :             }
    1304         [ #  # ]:          0 :         }
    1305                 :            :     }
    1306 [ #  # ][ #  # ]:          0 :     else if( !bLink && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_HTML ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1307                 :            :     {
    1308                 :          0 :         SotStorageStreamRef xStm;
    1309                 :            : 
    1310 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_HTML, xStm ) )
    1311                 :            :         {
    1312         [ #  # ]:          0 :             xStm->Seek( 0 );
    1313                 :            :             // mba: clipboard always must contain absolute URLs (could be from alien source)
    1314 [ #  # ][ #  # ]:          0 :             bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_HTML, maDropPos, pPage, nPasteOptions );
                 [ #  # ]
    1315         [ #  # ]:          0 :         }
    1316                 :            :     }
    1317 [ #  # ][ #  # ]:          0 :     else if( !bLink && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EDITENGINE ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1318                 :            :     {
    1319                 :          0 :         SotStorageStreamRef xStm;
    1320                 :            : 
    1321 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_EDITENGINE, xStm ) )
    1322                 :            :         {
    1323                 :          0 :             OutlinerView* pOLV = GetTextEditOutlinerView();
    1324                 :            : 
    1325         [ #  # ]:          0 :             xStm->Seek( 0 );
    1326                 :            : 
    1327         [ #  # ]:          0 :             if( pOLV )
    1328                 :            :             {
    1329         [ #  # ]:          0 :                 Rectangle   aRect( pOLV->GetOutputArea() );
    1330 [ #  # ][ #  # ]:          0 :                    Point       aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
    1331                 :            : 
    1332 [ #  # ][ #  # ]:          0 :                 if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1333                 :            :                 {
    1334                 :            :                     // mba: clipboard always must contain absolute URLs (could be from alien source)
    1335 [ #  # ][ #  # ]:          0 :                     pOLV->Read( *xStm, String(), EE_FORMAT_BIN, sal_False, mpDocSh->GetHeaderAttributes() );
         [ #  # ][ #  # ]
    1336                 :          0 :                     bReturn = sal_True;
    1337                 :            :                 }
    1338                 :            :             }
    1339                 :            : 
    1340         [ #  # ]:          0 :             if( !bReturn )
    1341                 :            :                 // mba: clipboard always must contain absolute URLs (could be from alien source)
    1342 [ #  # ][ #  # ]:          0 :                 bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_BIN, maDropPos, pPage, nPasteOptions );
                 [ #  # ]
    1343         [ #  # ]:          0 :         }
    1344                 :            :     }
    1345 [ #  # ][ #  # ]:          0 :     else if( !bLink && CHECK_FORMAT_TRANS( FORMAT_RTF ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1346                 :            :     {
    1347                 :          0 :         SotStorageStreamRef xStm;
    1348                 :            : 
    1349 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetSotStorageStream( FORMAT_RTF, xStm ) )
    1350                 :            :         {
    1351         [ #  # ]:          0 :             xStm->Seek( 0 );
    1352                 :            : 
    1353         [ #  # ]:          0 :             if( bTable )
    1354                 :            :             {
    1355 [ #  # ][ #  # ]:          0 :                 bReturn = PasteRTFTable( xStm, pPage, nPasteOptions );
    1356                 :            :             }
    1357                 :            :             else
    1358                 :            :             {
    1359                 :          0 :                 OutlinerView* pOLV = GetTextEditOutlinerView();
    1360                 :            : 
    1361         [ #  # ]:          0 :                 if( pOLV )
    1362                 :            :                 {
    1363         [ #  # ]:          0 :                     Rectangle   aRect( pOLV->GetOutputArea() );
    1364 [ #  # ][ #  # ]:          0 :                        Point       aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
    1365                 :            : 
    1366 [ #  # ][ #  # ]:          0 :                     if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1367                 :            :                     {
    1368                 :            :                         // mba: clipboard always must contain absolute URLs (could be from alien source)
    1369 [ #  # ][ #  # ]:          0 :                         pOLV->Read( *xStm, String(), EE_FORMAT_RTF, sal_False, mpDocSh->GetHeaderAttributes() );
         [ #  # ][ #  # ]
    1370                 :          0 :                         bReturn = sal_True;
    1371                 :            :                     }
    1372                 :            :                 }
    1373                 :            : 
    1374         [ #  # ]:          0 :                 if( !bReturn )
    1375                 :            :                     // mba: clipboard always must contain absolute URLs (could be from alien source)
    1376 [ #  # ][ #  # ]:          0 :                     bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_RTF, maDropPos, pPage, nPasteOptions );
                 [ #  # ]
    1377                 :            :             }
    1378         [ #  # ]:          0 :         }
    1379                 :            :     }
    1380 [ #  # ][ #  # ]:          0 :     else if( CHECK_FORMAT_TRANS( FORMAT_FILE_LIST ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1381                 :            :     {
    1382         [ #  # ]:          0 :         FileList aDropFileList;
    1383                 :            : 
    1384 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetFileList( FORMAT_FILE_LIST, aDropFileList ) )
    1385                 :            :         {
    1386                 :          0 :             maDropFileVector.clear();
    1387                 :            : 
    1388 [ #  # ][ #  # ]:          0 :             for( sal_uLong i = 0, nCount = aDropFileList.Count(); i < nCount; i++ )
    1389 [ #  # ][ #  # ]:          0 :                 maDropFileVector.push_back( aDropFileList.GetFile( i ) );
                 [ #  # ]
    1390                 :            : 
    1391         [ #  # ]:          0 :             maDropInsertFileTimer.Start();
    1392                 :            :         }
    1393                 :            : 
    1394         [ #  # ]:          0 :         bReturn = sal_True;
    1395                 :            :     }
    1396 [ #  # ][ #  # ]:          0 :     else if( CHECK_FORMAT_TRANS( FORMAT_FILE ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1397                 :            :     {
    1398         [ #  # ]:          0 :         String aDropFile;
    1399                 :            : 
    1400 [ #  # ][ #  # ]:          0 :         if( aDataHelper.GetString( FORMAT_FILE, aDropFile ) )
    1401                 :            :         {
    1402                 :          0 :             maDropFileVector.clear();
    1403         [ #  # ]:          0 :             maDropFileVector.push_back( aDropFile );
    1404         [ #  # ]:          0 :             maDropInsertFileTimer.Start();
    1405                 :            :         }
    1406                 :            : 
    1407         [ #  # ]:          0 :         bReturn = sal_True;
    1408                 :            :     }
    1409 [ #  # ][ #  # ]:          0 :     else if( !bLink && CHECK_FORMAT_TRANS( FORMAT_STRING ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1410                 :            :     {
    1411 [ #  # ][ #  # ]:          0 :         if( ( FORMAT_STRING == nFormat ) ||
         [ #  # ][ #  # ]
                 [ #  # ]
    1412         [ #  # ]:          0 :             ( !aDataHelper.HasFormat( SOT_FORMATSTR_ID_SOLK ) &&
    1413         [ #  # ]:          0 :               !aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
    1414         [ #  # ]:          0 :               !aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILENAME ) ) )
    1415                 :            :         {
    1416                 :          0 :             ::rtl::OUString aOUString;
    1417                 :            : 
    1418 [ #  # ][ #  # ]:          0 :             if( aDataHelper.GetString( FORMAT_STRING, aOUString ) )
    1419                 :            :             {
    1420                 :          0 :                 OutlinerView* pOLV = GetTextEditOutlinerView();
    1421                 :            : 
    1422         [ #  # ]:          0 :                 if( pOLV )
    1423                 :            :                 {
    1424 [ #  # ][ #  # ]:          0 :                     pOLV->InsertText( aOUString );
                 [ #  # ]
    1425                 :          0 :                     bReturn = sal_True;
    1426                 :            :                 }
    1427                 :            : 
    1428         [ #  # ]:          0 :                 if( !bReturn )
    1429 [ #  # ][ #  # ]:          0 :                     bReturn = SdrView::Paste( aOUString, maDropPos, pPage, nPasteOptions );
                 [ #  # ]
    1430                 :          0 :             }
    1431                 :            :         }
    1432                 :            :     }
    1433                 :            : 
    1434         [ #  # ]:          0 :     MarkListHasChanged();
    1435                 :          0 :     mbIsDropAllowed = sal_True;
    1436                 :          0 :     rDnDAction = mnAction;
    1437 [ #  # ][ #  # ]:          0 :     delete pImageMap;
    1438                 :            : 
    1439         [ #  # ]:          0 :     return bReturn;
    1440                 :            : }
    1441                 :            : 
    1442                 :            : extern void CreateTableFromRTF( SvStream& rStream, SdDrawDocument* pModel  );
    1443                 :            : 
    1444                 :          0 : bool View::PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions )
    1445                 :            : {
    1446 [ #  # ][ #  # ]:          0 :     SdDrawDocument* pModel = new SdDrawDocument( DOCUMENT_TYPE_IMPRESS, mpDocSh );
    1447         [ #  # ]:          0 :     pModel->NewOrLoadCompleted(NEW_DOC);
    1448         [ #  # ]:          0 :     pModel->GetItemPool().SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
    1449 [ #  # ][ #  # ]:          0 :     pModel->InsertPage(pModel->AllocPage(false));
    1450                 :            : 
    1451 [ #  # ][ #  # ]:          0 :     Reference< XComponent > xComponent( new SdXImpressDocument( pModel, sal_True ) );
    1452 [ #  # ][ #  # ]:          0 :     pModel->setUnoModel( Reference< XInterface >::query( xComponent ) );
    1453                 :            : 
    1454         [ #  # ]:          0 :     CreateTableFromRTF( *xStm, pModel );
    1455         [ #  # ]:          0 :     bool bRet = Paste( *pModel, maDropPos, pPage, nPasteOptions );
    1456                 :            : 
    1457 [ #  # ][ #  # ]:          0 :     xComponent->dispose();
    1458                 :          0 :     xComponent.clear();
    1459                 :            : 
    1460 [ #  # ][ #  # ]:          0 :     delete pModel;
    1461                 :            : 
    1462                 :          0 :     return bRet;
    1463                 :            : }
    1464                 :            : 
    1465 [ +  - ][ +  - ]:         75 : } // end of namespace sd
    1466                 :            : 
    1467                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10