LCOV - code coverage report
Current view: top level - sd/source/ui/view - sdview3.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 724 0.1 %
Date: 2014-11-03 Functions: 2 7 28.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "View.hxx"
      21             : #include <com/sun/star/embed/XEmbedObjectClipboardCreator.hpp>
      22             : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
      23             : #include <com/sun/star/embed/MSOLEObjectSystemCreator.hpp>
      24             : #include <com/sun/star/lang/XComponent.hpp>
      25             : #include <sot/filelist.hxx>
      26             : #include <unotools/pathoptions.hxx>
      27             : #include <editeng/editdata.hxx>
      28             : #include <svl/urlbmk.hxx>
      29             : #include <svx/xexch.hxx>
      30             : #include <svx/xflclit.hxx>
      31             : #include <svx/xlnclit.hxx>
      32             : #include <svx/svdpagv.hxx>
      33             : #include <editeng/eeitem.hxx>
      34             : #include <editeng/colritem.hxx>
      35             : #include <sfx2/docfile.hxx>
      36             : #include <svx/svditer.hxx>
      37             : #include <svx/svdogrp.hxx>
      38             : #include <svx/svdoole2.hxx>
      39             : #include <svx/svdograf.hxx>
      40             : #include <svx/svdetc.hxx>
      41             : #include <svx/svdundo.hxx>
      42             : #include <sfx2/app.hxx>
      43             : #include <svl/itempool.hxx>
      44             : #include <comphelper/classids.hxx>
      45             : #include <svx/fmmodel.hxx>
      46             : #include <sot/formats.hxx>
      47             : #include <editeng/outliner.hxx>
      48             : #include <editeng/editeng.hxx>
      49             : #include <svx/obj3d.hxx>
      50             : #include <svx/e3dundo.hxx>
      51             : #include <svx/unomodel.hxx>
      52             : #include <unotools/streamwrap.hxx>
      53             : #include <vcl/metaact.hxx>
      54             : #include <svx/svxids.hrc>
      55             : #include <toolkit/helper/vclunohelper.hxx>
      56             : #include <svtools/embedhlp.hxx>
      57             : #include "DrawDocShell.hxx"
      58             : #include "fupoor.hxx"
      59             : #include "tablefunction.hxx"
      60             : #include "Window.hxx"
      61             : #include "sdxfer.hxx"
      62             : #include "sdpage.hxx"
      63             : #include "DrawViewShell.hxx"
      64             : #include "drawdoc.hxx"
      65             : #include "sdresid.hxx"
      66             : #include "strings.hrc"
      67             : #include "imapinfo.hxx"
      68             : #include "SlideSorterViewShell.hxx"
      69             : #include "strmname.h"
      70             : #include "unomodel.hxx"
      71             : #include "ViewClipboard.hxx"
      72             : #include <sfx2/ipclient.hxx>
      73             : #include <comphelper/storagehelper.hxx>
      74             : #include <comphelper/processfactory.hxx>
      75             : #include <tools/stream.hxx>
      76             : #include <vcl/cvtgrf.hxx>
      77             : #include <svx/sdrhittesthelper.hxx>
      78             : #include <svx/xbtmpit.hxx>
      79             : #include <boost/scoped_ptr.hpp>
      80             : 
      81             : // - Namespaces -
      82             : 
      83             : using namespace ::com::sun::star;
      84             : using namespace ::com::sun::star::lang;
      85             : using namespace ::com::sun::star::uno;
      86             : using namespace ::com::sun::star::io;
      87             : using namespace ::com::sun::star::datatransfer;
      88             : using namespace ::com::sun::star::datatransfer::clipboard;
      89             : 
      90             : namespace sd {
      91             : 
      92             : #define CHECK_FORMAT_TRANS( _def_Type ) ( ( nFormat == (_def_Type) || !nFormat ) && aDataHelper.HasFormat( _def_Type ) )
      93             : 
      94             : /*************************************************************************
      95             : |*
      96             : |* Paste
      97             : |*
      98             : \************************************************************************/
      99             : 
     100             : struct ImpRememberOrigAndClone
     101             : {
     102             :     SdrObject*      pOrig;
     103             :     SdrObject*      pClone;
     104             : };
     105             : 
     106           0 : SdrObject* ImpGetClone(std::vector<ImpRememberOrigAndClone*>& aConnectorContainer, SdrObject* pConnObj)
     107             : {
     108           0 :     for(sal_uInt32 a(0); a < aConnectorContainer.size(); a++)
     109             :     {
     110           0 :         if(pConnObj == aConnectorContainer[a]->pOrig)
     111           0 :             return aConnectorContainer[a]->pClone;
     112             :     }
     113           0 :     return 0L;
     114             : }
     115             : 
     116             : // restrict movement to WorkArea
     117           0 : void ImpCheckInsertPos(Point& rPos, const Size& rSize, const Rectangle& rWorkArea)
     118             : {
     119           0 :     if(!rWorkArea.IsEmpty())
     120             :     {
     121           0 :         Rectangle aMarkRect(Point(rPos.X() - (rSize.Width() / 2), rPos.Y() - (rSize.Height() / 2)), rSize);
     122             : 
     123           0 :         if(!aMarkRect.IsInside(rWorkArea))
     124             :         {
     125           0 :             if(aMarkRect.Left() < rWorkArea.Left())
     126             :             {
     127           0 :                 rPos.X() += rWorkArea.Left() - aMarkRect.Left();
     128             :             }
     129             : 
     130           0 :             if(aMarkRect.Right() > rWorkArea.Right())
     131             :             {
     132           0 :                 rPos.X() -= aMarkRect.Right() - rWorkArea.Right();
     133             :             }
     134             : 
     135           0 :             if(aMarkRect.Top() < rWorkArea.Top())
     136             :             {
     137           0 :                 rPos.Y() += rWorkArea.Top() - aMarkRect.Top();
     138             :             }
     139             : 
     140           0 :             if(aMarkRect.Bottom() > rWorkArea.Bottom())
     141             :             {
     142           0 :                 rPos.Y() -= aMarkRect.Bottom() - rWorkArea.Bottom();
     143             :             }
     144             :         }
     145             :     }
     146           0 : }
     147             : 
     148           0 : bool View::InsertMetaFile( TransferableDataHelper& rDataHelper, const Point& rPos, ImageMap* pImageMap, bool bOptimize )
     149             : {
     150           0 :     GDIMetaFile aMtf;
     151             : 
     152           0 :     if( !rDataHelper.GetGDIMetaFile( FORMAT_GDIMETAFILE, aMtf ) )
     153           0 :         return false;
     154             : 
     155           0 :     bool bVector = false;
     156           0 :     Graphic aGraphic;
     157             : 
     158             :     // check if metafile only contains a pixel image, if so insert a bitmap instead
     159           0 :     if( bOptimize )
     160             :     {
     161           0 :         MetaAction* pAction = aMtf.FirstAction();
     162           0 :         while( pAction && !bVector )
     163             :         {
     164           0 :             switch( pAction->GetType() )
     165             :             {
     166             :                 case META_POINT_ACTION:
     167             :                 case META_LINE_ACTION:
     168             :                 case META_RECT_ACTION:
     169             :                 case META_ROUNDRECT_ACTION:
     170             :                 case META_ELLIPSE_ACTION:
     171             :                 case META_ARC_ACTION:
     172             :                 case META_PIE_ACTION:
     173             :                 case META_CHORD_ACTION:
     174             :                 case META_POLYLINE_ACTION:
     175             :                 case META_POLYGON_ACTION:
     176             :                 case META_POLYPOLYGON_ACTION:
     177             :                 case META_TEXT_ACTION:
     178             :                 case META_TEXTARRAY_ACTION:
     179             :                 case META_STRETCHTEXT_ACTION:
     180             :                 case META_TEXTRECT_ACTION:
     181             :                 case META_GRADIENT_ACTION:
     182             :                 case META_HATCH_ACTION:
     183             :                 case META_WALLPAPER_ACTION:
     184             :                 case META_EPS_ACTION:
     185             :                 case META_TEXTLINE_ACTION:
     186             :                 case META_FLOATTRANSPARENT_ACTION:
     187             :                 case META_GRADIENTEX_ACTION:
     188             :                 case META_BMPSCALEPART_ACTION:
     189             :                 case META_BMPEXSCALEPART_ACTION:
     190           0 :                     bVector = true;
     191           0 :                     break;
     192             :                 case META_BMP_ACTION:
     193             :                 case META_BMPSCALE_ACTION:
     194             :                 case META_BMPEX_ACTION:
     195             :                 case META_BMPEXSCALE_ACTION:
     196           0 :                     if( aGraphic.GetType() != GRAPHIC_NONE )
     197             :                     {
     198           0 :                         bVector = true;
     199             :                     }
     200           0 :                     else switch( pAction->GetType() )
     201             :                     {
     202             :                         case META_BMP_ACTION:
     203             :                             {
     204           0 :                                 MetaBmpAction* pBmpAction = dynamic_cast< MetaBmpAction* >( pAction );
     205           0 :                                 if( pBmpAction )
     206           0 :                                     aGraphic = Graphic( pBmpAction->GetBitmap() );
     207             :                             }
     208           0 :                             break;
     209             :                         case META_BMPSCALE_ACTION:
     210             :                             {
     211           0 :                                 MetaBmpScaleAction* pBmpScaleAction = dynamic_cast< MetaBmpScaleAction* >( pAction );
     212           0 :                                 if( pBmpScaleAction )
     213           0 :                                     aGraphic = Graphic( pBmpScaleAction->GetBitmap() );
     214             :                             }
     215           0 :                             break;
     216             :                         case META_BMPEX_ACTION:
     217             :                             {
     218           0 :                                 MetaBmpExAction* pBmpExAction = dynamic_cast< MetaBmpExAction* >( pAction );
     219           0 :                                 if( pBmpExAction )
     220           0 :                                     aGraphic = Graphic( pBmpExAction->GetBitmapEx() );
     221             :                             }
     222           0 :                             break;
     223             :                         case META_BMPEXSCALE_ACTION:
     224             :                             {
     225           0 :                                 MetaBmpExScaleAction* pBmpExScaleAction = dynamic_cast< MetaBmpExScaleAction* >( pAction );
     226           0 :                                 if( pBmpExScaleAction )
     227           0 :                                     aGraphic = Graphic( pBmpExScaleAction->GetBitmapEx() );
     228             :                             }
     229           0 :                             break;
     230             :                     }
     231             :             }
     232             : 
     233           0 :             pAction = aMtf.NextAction();
     234             :         }
     235             :     }
     236             : 
     237             :     // it is not a vector metafile but it also has no graphic?
     238           0 :     if( !bVector && (aGraphic.GetType() == GRAPHIC_NONE) )
     239           0 :         bVector = true;
     240             : 
     241             :     // restrict movement to WorkArea
     242           0 :     Point aInsertPos( rPos );
     243           0 :     Size aImageSize;
     244           0 :     aImageSize = bVector ? aMtf.GetPrefSize() : aGraphic.GetSizePixel();
     245           0 :     ImpCheckInsertPos(aInsertPos, aImageSize, GetWorkArea());
     246             : 
     247           0 :     if( bVector )
     248           0 :         aGraphic = Graphic( aMtf );
     249             : 
     250           0 :     aGraphic.SetPrefMapMode( aMtf.GetPrefMapMode() );
     251           0 :     aGraphic.SetPrefSize( aMtf.GetPrefSize() );
     252           0 :     InsertGraphic( aGraphic, mnAction, aInsertPos, NULL, pImageMap );
     253             : 
     254           0 :     return true;
     255             : }
     256             : 
     257           0 : bool View::InsertData( const TransferableDataHelper& rDataHelper,
     258             :                          const Point& rPos, sal_Int8& rDnDAction, bool bDrag,
     259             :                          sal_uLong nFormat, sal_uInt16 nPage, sal_uInt16 nLayer )
     260             : {
     261           0 :     maDropPos = rPos;
     262           0 :     mnAction = rDnDAction;
     263           0 :     mbIsDropAllowed = false;
     264             : 
     265           0 :     TransferableDataHelper  aDataHelper( rDataHelper );
     266           0 :     SdrObject*              pPickObj = NULL;
     267           0 :     SdPage*                 pPage = NULL;
     268           0 :     boost::scoped_ptr<ImageMap> pImageMap;
     269           0 :     bool bReturn = false;
     270           0 :     bool                    bLink = ( ( mnAction & DND_ACTION_LINK ) != 0 );
     271           0 :     bool                    bCopy = ( ( ( mnAction & DND_ACTION_COPY ) != 0 ) || bLink );
     272           0 :     sal_uLong                   nPasteOptions = SDRINSERT_SETDEFLAYER;
     273             : 
     274           0 :     if (mpViewSh != NULL)
     275             :     {
     276             :         OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
     277           0 :         SfxInPlaceClient* pIpClient = mpViewSh->GetViewShell()->GetIPClient();
     278           0 :         if( mpViewSh->ISA(::sd::slidesorter::SlideSorterViewShell)
     279           0 :             || (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive()))
     280           0 :         nPasteOptions |= SDRINSERT_DONTMARK;
     281             :     }
     282             : 
     283           0 :     if( bDrag )
     284             :     {
     285           0 :         SdrPageView* pPV = NULL;
     286           0 :         PickObj( rPos, getHitTolLog(), pPickObj, pPV );
     287             :     }
     288             : 
     289           0 :     if( nPage != SDRPAGE_NOTFOUND )
     290           0 :         pPage = (SdPage*) mrDoc.GetPage( nPage );
     291             : 
     292           0 :     SdTransferable* pOwnData = NULL;
     293           0 :     SdTransferable* pImplementation = SdTransferable::getImplementation( aDataHelper.GetTransferable() );
     294             : 
     295           0 :     if(pImplementation && (rDnDAction & DND_ACTION_LINK))
     296             :     {
     297             :         // suppress own data when it's intention is to use it as fill information
     298           0 :         pImplementation = 0;
     299             :     }
     300             : 
     301             :     // try to get own transfer data
     302           0 :     if( pImplementation )
     303             :     {
     304           0 :         if( SD_MOD()->pTransferClip == (SdTransferable*) pImplementation )
     305           0 :             pOwnData = SD_MOD()->pTransferClip;
     306           0 :         else if( SD_MOD()->pTransferDrag == (SdTransferable*) pImplementation )
     307           0 :             pOwnData = SD_MOD()->pTransferDrag;
     308           0 :         else if( SD_MOD()->pTransferSelection == (SdTransferable*) pImplementation )
     309           0 :             pOwnData = SD_MOD()->pTransferSelection;
     310             :     }
     311             : 
     312             :     // ImageMap?
     313           0 :     if( !pOwnData && aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVIM ) )
     314             :     {
     315           0 :         SotStorageStreamRef xStm;
     316             : 
     317           0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_SVIM, xStm ) )
     318             :         {
     319           0 :             pImageMap.reset(new ImageMap);
     320             :             // mba: clipboard always must contain absolute URLs (could be from alien source)
     321           0 :             pImageMap->Read( *xStm, OUString() );
     322           0 :         }
     323             :     }
     324             : 
     325           0 :     bool bTable = false;
     326             :     // check special cases for pasting table formats as RTL
     327           0 :     if( !bLink && (!nFormat || (nFormat == SOT_FORMAT_RTF)) )
     328             :     {
     329             :         // if the objekt supports rtf and there is a table involved, default is to create a table
     330           0 :         if( aDataHelper.HasFormat( SOT_FORMAT_RTF ) && ! aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ) )
     331             :         {
     332           0 :             SotStorageStreamRef xStm;
     333             : 
     334           0 :             if( aDataHelper.GetSotStorageStream( FORMAT_RTF, xStm ) )
     335             :             {
     336           0 :                 xStm->Seek( 0 );
     337             : 
     338           0 :                 OString aLine;
     339           0 :                 while (xStm->ReadLine(aLine))
     340             :                 {
     341           0 :                     sal_Int32 x = aLine.indexOf( "\\trowd" );
     342           0 :                     if (x != -1)
     343             :                     {
     344           0 :                         bTable = true;
     345           0 :                         nFormat = FORMAT_RTF;
     346           0 :                         break;
     347             :                     }
     348           0 :                 }
     349           0 :             }
     350             :         }
     351             :     }
     352             : 
     353             :     // Changed the whole decision tree to be dependent of bReturn as a flag that
     354             :     // the work was done; this allows to check multiple formats and not just fail
     355             :     // when a CHECK_FORMAT_TRANS(*format*) detected format does not work. This is
     356             :     // e.g. necessary for FORMAT_BITMAP
     357           0 :     if( pOwnData && !nFormat )
     358             :     {
     359           0 :         const View* pSourceView = pOwnData->GetView();
     360             : 
     361           0 :         if( pOwnData->GetDocShell() && pOwnData->IsPageTransferable() && ISA( View ) )
     362             :         {
     363           0 :             mpClipboard->HandlePageDrop (*pOwnData);
     364           0 :             bReturn = true;
     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 :                     OUString        aLayer = pLayer->GetName();
     378             : 
     379           0 :                     if( !pPV->IsLayerLocked( aLayer ) )
     380             :                     {
     381           0 :                         pOwnData->SetInternalMove( true );
     382           0 :                         SortMarkedObjects();
     383             : 
     384           0 :                         for( size_t 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(SD_RESSTR(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 = true;
     404           0 :                     }
     405             :                 }
     406             :                 else
     407             :                 {
     408           0 :                     SdrPageView*    pPV = GetSdrPageView();
     409           0 :                     bool            bDropOnTabBar = true;
     410             : 
     411           0 :                     if( !pPage && pPV->GetPage()->GetPageNum() != mnDragSrcPgNum )
     412             :                     {
     413           0 :                         pPage = (SdPage*) pPV->GetPage();
     414           0 :                         bDropOnTabBar = false;
     415             :                     }
     416             : 
     417           0 :                     if( pPage )
     418             :                     {
     419             :                         // drop on other page
     420           0 :                         OUString 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 :                                 size_t nConnectorCount = 0;
     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(size_t 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(SD_RESSTR(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(size_t 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(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(false, pConnClone);
     515           0 :                                                     pCloneEdge->GetConnection(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(false, aPosition);
     532             :                                                         }
     533             :                                                     }
     534             :                                                 }
     535             :                                             }
     536             : 
     537             :                                             // test second connection
     538           0 :                                             SdrObjConnection& rConn1 = pOrigEdge->GetConnection(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(true, pConnClone);
     547           0 :                                                     pCloneEdge->GetConnection(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(true, aPosition);
     564             :                                                         }
     565             :                                                     }
     566             :                                                 }
     567             :                                             }
     568             :                                         }
     569             :                                     }
     570             :                                 }
     571             : 
     572             :                                 // cleanup remember classes
     573           0 :                                 for(size_t 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 = true;
     580             :                             }
     581             :                             else
     582             :                             {
     583           0 :                                 maDropErrorTimer.Start();
     584           0 :                                 bReturn = false;
     585             :                             }
     586           0 :                         }
     587             :                     }
     588             :                     else
     589             :                     {
     590           0 :                         pOwnData->SetInternalMove( true );
     591           0 :                         MoveAllMarked( Size( maDropPos.X() - pOwnData->GetStartPos().X(),
     592           0 :                                              maDropPos.Y() - pOwnData->GetStartPos().Y() ), bCopy );
     593           0 :                         bReturn = 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->GetMarkedObjModel();
     606           0 :                     bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
     607             : 
     608           0 :                     if( !pPage )
     609           0 :                         pPage = (SdPage*) GetSdrPageView()->GetPage();
     610             : 
     611           0 :                     OUString aLayout = pPage->GetLayoutName();
     612           0 :                     sal_Int32 nPos = aLayout.indexOf(SD_LT_SEPARATOR);
     613           0 :                     if (nPos != -1)
     614           0 :                         aLayout = aLayout.copy(0, nPos);
     615           0 :                     pPage->SetPresentationLayout( aLayout, false, false );
     616           0 :                     pSourceDoc->CreatingDataObj( NULL );
     617             :                 }
     618             :                 else
     619             :                 {
     620           0 :                     maDropErrorTimer.Start();
     621           0 :                     bReturn = false;
     622             :                 }
     623             :             }
     624             :         }
     625             :         else
     626             :         {
     627           0 :             SdDrawDocument* pWorkModel = (SdDrawDocument*) pOwnData->GetWorkDocument();
     628           0 :             SdPage*         pWorkPage = (SdPage*) pWorkModel->GetSdPage( 0, PK_STANDARD );
     629             : 
     630           0 :             pWorkPage->SetRectsDirty();
     631             : 
     632             :             // #i120393# Clipboard data uses full object geometry range
     633           0 :             const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
     634             : 
     635           0 :             maDropPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
     636           0 :             maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
     637             : 
     638             :             // delete pages, that are not of any interest for us
     639           0 :             for( long i = ( pWorkModel->GetPageCount() - 1 ); i >= 0; i-- )
     640             :             {
     641           0 :                 SdPage* pP = static_cast< SdPage* >( pWorkModel->GetPage( (sal_uInt16) i ) );
     642             : 
     643           0 :                 if( pP->GetPageKind() != PK_STANDARD )
     644           0 :                     pWorkModel->DeletePage( (sal_uInt16) i );
     645             :             }
     646             : 
     647           0 :             bReturn = Paste(*pWorkModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
     648             : 
     649           0 :             if( !pPage )
     650           0 :                 pPage = (SdPage*) GetSdrPageView()->GetPage();
     651             : 
     652           0 :             OUString aLayout = pPage->GetLayoutName();
     653           0 :             sal_Int32 nPos = aLayout.indexOf(SD_LT_SEPARATOR);
     654           0 :             if (nPos != -1)
     655           0 :                 aLayout = aLayout.copy(0, nPos);
     656           0 :             pPage->SetPresentationLayout( aLayout, false, false );
     657             :        }
     658             :     }
     659             : 
     660           0 :     if(!bReturn && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_DRAWING ))
     661             :     {
     662           0 :         SotStorageStreamRef xStm;
     663             : 
     664           0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStm ) )
     665             :         {
     666           0 :             bool bChanged = false;
     667             : 
     668           0 :             DrawDocShellRef xShell = new DrawDocShell(SFX_CREATE_MODE_INTERNAL);
     669           0 :             xShell->DoInitNew(0);
     670             : 
     671           0 :             SdDrawDocument* pModel = xShell->GetDoc();
     672           0 :             pModel->InsertPage(pModel->AllocPage(false));
     673             : 
     674           0 :             Reference< XComponent > xComponent( xShell->GetModel(), UNO_QUERY );
     675           0 :             xStm->Seek( 0 );
     676             : 
     677           0 :             com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm ) );
     678           0 :             bReturn = SvxDrawingLayerImport( pModel, xInputStream, xComponent, "com.sun.star.comp.Impress.XMLOasisImporter" );
     679             : 
     680           0 :             if( pModel->GetPageCount() == 0 )
     681             :             {
     682             :                 OSL_FAIL("empty or invalid drawing xml document on clipboard!" );
     683             :             }
     684             :             else
     685             :             {
     686           0 :                 if( bReturn )
     687             :                 {
     688           0 :                     if( pModel->GetSdPage( 0, PK_STANDARD )->GetObjCount() == 1 )
     689             :                     {
     690             :                         // only one object
     691           0 :                         SdrObject*      pObj = pModel->GetSdPage( 0, PK_STANDARD )->GetObj( 0 );
     692           0 :                         SdrObject*      pPickObj2 = NULL;
     693           0 :                         SdrPageView*    pPV = NULL;
     694           0 :                         PickObj( rPos, getHitTolLog(), pPickObj2, pPV );
     695             : 
     696           0 :                         if( ( mnAction & DND_ACTION_MOVE ) && pPickObj2 && pObj )
     697             :                         {
     698             :                             // replace object
     699           0 :                             SdrObject*  pNewObj = pObj->Clone();
     700           0 :                             Rectangle   aPickObjRect( pPickObj2->GetCurrentBoundRect() );
     701           0 :                             Size        aPickObjSize( aPickObjRect.GetSize() );
     702           0 :                             Point       aVec( aPickObjRect.TopLeft() );
     703           0 :                             Rectangle   aObjRect( pNewObj->GetCurrentBoundRect() );
     704           0 :                             Size        aObjSize( aObjRect.GetSize() );
     705             : 
     706           0 :                             Fraction aScaleWidth( aPickObjSize.Width(), aObjSize.Width() );
     707           0 :                             Fraction aScaleHeight( aPickObjSize.Height(), aObjSize.Height() );
     708           0 :                             pNewObj->NbcResize( aObjRect.TopLeft(), aScaleWidth, aScaleHeight );
     709             : 
     710           0 :                             aVec -= aObjRect.TopLeft();
     711           0 :                             pNewObj->NbcMove( Size( aVec.X(), aVec.Y() ) );
     712             : 
     713           0 :                             const bool bUndo = IsUndoEnabled();
     714             : 
     715           0 :                             if( bUndo )
     716           0 :                                 BegUndo(SD_RESSTR(STR_UNDO_DRAGDROP));
     717           0 :                             pNewObj->NbcSetLayer( pPickObj->GetLayer() );
     718           0 :                             SdrPage* pWorkPage = GetSdrPageView()->GetPage();
     719           0 :                             pWorkPage->InsertObject( pNewObj );
     720           0 :                             if( bUndo )
     721             :                             {
     722           0 :                                 AddUndo( mrDoc.GetSdrUndoFactory().CreateUndoNewObject( *pNewObj ) );
     723           0 :                                 AddUndo( mrDoc.GetSdrUndoFactory().CreateUndoDeleteObject( *pPickObj2 ) );
     724             :                             }
     725           0 :                             pWorkPage->RemoveObject( pPickObj2->GetOrdNum() );
     726             : 
     727           0 :                             if( bUndo )
     728             :                             {
     729           0 :                                 EndUndo();
     730             :                             }
     731             :                             else
     732             :                             {
     733           0 :                                 SdrObject::Free(pPickObj2 );
     734             :                             }
     735           0 :                             bChanged = true;
     736           0 :                             mnAction = DND_ACTION_COPY;
     737             :                         }
     738           0 :                         else if( ( mnAction & DND_ACTION_LINK ) && pPickObj && pObj && !pPickObj->ISA( SdrGrafObj ) && !pPickObj->ISA( SdrOle2Obj ) )
     739             :                         {
     740           0 :                             SfxItemSet aSet( mrDoc.GetPool() );
     741             : 
     742             :                             // set new attributes to object
     743           0 :                             const bool bUndo = IsUndoEnabled();
     744           0 :                             if( bUndo )
     745             :                             {
     746           0 :                                 BegUndo( SD_RESSTR(STR_UNDO_DRAGDROP) );
     747           0 :                                 AddUndo( mrDoc.GetSdrUndoFactory().CreateUndoAttrObject( *pPickObj ) );
     748             :                             }
     749             : 
     750           0 :                             aSet.Put( pObj->GetMergedItemSet() );
     751             : 
     752             :                             /* Do not take over corner radius. There are
     753             :                                gradients (rectangles) in the gallery with corner
     754             :                                radius of 0. We should not use that on the
     755             :                                object. */
     756           0 :                             aSet.ClearItem( SDRATTR_ECKENRADIUS );
     757             : 
     758           0 :                             const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
     759             : 
     760           0 :                             if(pSdrGrafObj)
     761             :                             {
     762             :                                 // If we have a graphic as source object, use it's graphic
     763             :                                 // content as fill style
     764           0 :                                 aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
     765           0 :                                 aSet.Put(XFillBitmapItem(&mrDoc.GetPool(), pSdrGrafObj->GetGraphic()));
     766             :                             }
     767             : 
     768           0 :                             pPickObj->SetMergedItemSetAndBroadcast( aSet );
     769             : 
     770           0 :                             if( pPickObj->ISA( E3dObject ) && pObj->ISA( E3dObject ) )
     771             :                             {
     772             :                                 // handle 3D attribute in addition
     773           0 :                                 SfxItemSet aNewSet( mrDoc.GetPool(), SID_ATTR_3D_START, SID_ATTR_3D_END, 0 );
     774           0 :                                 SfxItemSet aOldSet( mrDoc.GetPool(), SID_ATTR_3D_START, SID_ATTR_3D_END, 0 );
     775             : 
     776           0 :                                 aOldSet.Put(pPickObj->GetMergedItemSet());
     777           0 :                                 aNewSet.Put( pObj->GetMergedItemSet() );
     778             : 
     779           0 :                                 if( bUndo )
     780           0 :                                     AddUndo( new E3dAttributesUndoAction( mrDoc, (E3dObject*) pPickObj, aNewSet, aOldSet ) );
     781           0 :                                 pPickObj->SetMergedItemSetAndBroadcast( aNewSet );
     782             :                             }
     783             : 
     784           0 :                             if( bUndo )
     785           0 :                                 EndUndo();
     786           0 :                             bChanged = true;
     787             :                         }
     788             :                     }
     789             :                 }
     790             : 
     791           0 :                 if( !bChanged )
     792             :                 {
     793           0 :                     SdrPage* pWorkPage = pModel->GetSdPage( 0, PK_STANDARD );
     794             : 
     795           0 :                     pWorkPage->SetRectsDirty();
     796             : 
     797           0 :                     if( pOwnData )
     798             :                     {
     799             :                         // #i120393# Clipboard data uses full object geometry range
     800           0 :                         const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
     801             : 
     802           0 :                         maDropPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
     803           0 :                         maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
     804             :                     }
     805             : 
     806           0 :                     bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
     807             :                 }
     808             : 
     809           0 :                 xShell->DoClose();
     810           0 :             }
     811           0 :         }
     812             :     }
     813             : 
     814           0 :     if(!bReturn && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE))
     815             :     {
     816           0 :         OUString aOUString;
     817             : 
     818           0 :         if( aDataHelper.GetString( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, aOUString ) )
     819             :         {
     820           0 :             SdrObject* pObj = CreateFieldControl( aOUString );
     821             : 
     822           0 :             if( pObj )
     823             :             {
     824           0 :                 Rectangle   aRect( pObj->GetLogicRect() );
     825           0 :                 Size        aSize( aRect.GetSize() );
     826             : 
     827           0 :                 maDropPos.X() -= ( aSize.Width() >> 1 );
     828           0 :                 maDropPos.Y() -= ( aSize.Height() >> 1 );
     829             : 
     830           0 :                 aRect.SetPos( maDropPos );
     831           0 :                 pObj->SetLogicRect( aRect );
     832           0 :                 InsertObjectAtView( pObj, *GetSdrPageView(), SDRINSERT_SETDEFLAYER );
     833           0 :                 bReturn = true;
     834             :             }
     835           0 :         }
     836             :     }
     837             : 
     838           0 :     if(!bReturn &&
     839           0 :         !bLink &&
     840           0 :         (CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBED_SOURCE) || CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBEDDED_OBJ))  &&
     841           0 :         aDataHelper.HasFormat(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR))
     842             :     {
     843             :         //TODO/LATER: is it possible that this format is binary?! (from old versions of SO)
     844           0 :         uno::Reference < io::XInputStream > xStm;
     845           0 :         TransferableObjectDescriptor    aObjDesc;
     846             : 
     847           0 :         if (aDataHelper.GetTransferableObjectDescriptor(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc))
     848             :         {
     849           0 :             OUString aDocShellID = SfxObjectShell::CreateShellID(mrDoc.GetDocSh());
     850           0 :             xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE, aDocShellID);
     851           0 :             if (!xStm.is())
     852           0 :                 xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ, aDocShellID);
     853             :         }
     854             : 
     855           0 :         if (xStm.is())
     856             :         {
     857           0 :             if( mrDoc.GetDocSh() && ( mrDoc.GetDocSh()->GetClassName() == aObjDesc.maClassName ) )
     858             :             {
     859           0 :                 uno::Reference < embed::XStorage > xStore( ::comphelper::OStorageHelper::GetStorageFromInputStream( xStm ) );
     860           0 :                 ::sd::DrawDocShellRef xDocShRef( new ::sd::DrawDocShell( SFX_CREATE_MODE_EMBEDDED, true, mrDoc.GetDocumentType() ) );
     861             : 
     862             :                 // mba: BaseURL doesn't make sense for clipboard functionality
     863           0 :                 SfxMedium *pMedium = new SfxMedium( xStore, OUString() );
     864           0 :                 if( xDocShRef->DoLoad( pMedium ) )
     865             :                 {
     866           0 :                     SdDrawDocument* pModel = (SdDrawDocument*) xDocShRef->GetDoc();
     867           0 :                     SdPage*         pWorkPage = (SdPage*) pModel->GetSdPage( 0, PK_STANDARD );
     868             : 
     869           0 :                     pWorkPage->SetRectsDirty();
     870             : 
     871           0 :                     if( pOwnData )
     872             :                     {
     873             :                         // #i120393# Clipboard data uses full object geometry range
     874           0 :                         const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
     875             : 
     876           0 :                         maDropPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
     877           0 :                         maDropPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
     878             :                     }
     879             : 
     880             :                     // delete pages, that are not of any interest for us
     881           0 :                     for( long i = ( pModel->GetPageCount() - 1 ); i >= 0; i-- )
     882             :                     {
     883           0 :                         SdPage* pP = static_cast< SdPage* >( pModel->GetPage( (sal_uInt16) i ) );
     884             : 
     885           0 :                         if( pP->GetPageKind() != PK_STANDARD )
     886           0 :                             pModel->DeletePage( (sal_uInt16) i );
     887             :                     }
     888             : 
     889           0 :                     bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
     890             : 
     891           0 :                     if( !pPage )
     892           0 :                         pPage = (SdPage*) GetSdrPageView()->GetPage();
     893             : 
     894           0 :                     OUString aLayout = pPage->GetLayoutName();
     895           0 :                     sal_Int32 nPos = aLayout.indexOf(SD_LT_SEPARATOR);
     896           0 :                     if (nPos != -1)
     897           0 :                         aLayout = aLayout.copy(0, nPos);
     898           0 :                     pPage->SetPresentationLayout( aLayout, false, false );
     899             :                 }
     900             : 
     901           0 :                 xDocShRef->DoClose();
     902           0 :                 xDocShRef.Clear();
     903             : 
     904             :             }
     905             :             else
     906             :             {
     907           0 :                 OUString aName;
     908           0 :                 uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
     909           0 :                 if ( xObj.is() )
     910             :                 {
     911           0 :                     svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );
     912             : 
     913             :                     // try to get the replacement image from the clipboard
     914           0 :                     Graphic aGraphic;
     915           0 :                     sal_uLong nGrFormat = 0;
     916             : 
     917             :                     // insert replacement image ( if there is one ) into the object helper
     918           0 :                     if ( nGrFormat )
     919             :                     {
     920           0 :                         datatransfer::DataFlavor aDataFlavor;
     921           0 :                         SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
     922           0 :                         aObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
     923             :                     }
     924             : 
     925           0 :                     Size aSize;
     926           0 :                     if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
     927             :                     {
     928           0 :                         if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
     929           0 :                             aSize = aObjDesc.maSize;
     930             :                         else
     931             :                         {
     932           0 :                             MapMode aMapMode( MAP_100TH_MM );
     933           0 :                             aSize = aObjRef.GetSize( &aMapMode );
     934             :                         }
     935             :                     }
     936             :                     else
     937             :                     {
     938           0 :                         awt::Size aSz;
     939           0 :                         MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
     940           0 :                         if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
     941             :                         {
     942           0 :                             Size aTmp( OutputDevice::LogicToLogic( aObjDesc.maSize, MAP_100TH_MM, aMapUnit ) );
     943           0 :                             aSz.Width = aTmp.Width();
     944           0 :                             aSz.Height = aTmp.Height();
     945           0 :                             xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
     946             :                         }
     947             : 
     948             :                         try
     949             :                         {
     950           0 :                             aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
     951             :                         }
     952           0 :                         catch( embed::NoVisualAreaSizeException& )
     953             :                         {
     954             :                             // if the size still was not set the default size will be set later
     955             :                         }
     956             : 
     957           0 :                         aSize = Size( aSz.Width, aSz.Height );
     958             : 
     959           0 :                         if( !aSize.Width() || !aSize.Height() )
     960             :                         {
     961           0 :                             aSize.Width()  = 14100;
     962           0 :                             aSize.Height() = 10000;
     963           0 :                             aSize = OutputDevice::LogicToLogic( Size(14100, 10000), MAP_100TH_MM, aMapUnit );
     964           0 :                             aSz.Width = aSize.Width();
     965           0 :                             aSz.Height = aSize.Height();
     966           0 :                             xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
     967             :                         }
     968             : 
     969           0 :                         aSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MAP_100TH_MM );
     970             :                     }
     971             : 
     972           0 :                     Size aMaxSize( mrDoc.GetMaxObjSize() );
     973             : 
     974           0 :                     maDropPos.X() -= std::min( aSize.Width(), aMaxSize.Width() ) >> 1;
     975           0 :                     maDropPos.Y() -= std::min( aSize.Height(), aMaxSize.Height() ) >> 1;
     976             : 
     977           0 :                     Rectangle       aRect( maDropPos, aSize );
     978           0 :                     SdrOle2Obj*     pObj = new SdrOle2Obj( aObjRef, aName, aRect );
     979           0 :                     SdrPageView*    pPV = GetSdrPageView();
     980           0 :                     sal_uLong           nOptions = SDRINSERT_SETDEFLAYER;
     981             : 
     982           0 :                     if (mpViewSh!=NULL)
     983             :                     {
     984             :                         OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
     985             :                         SfxInPlaceClient* pIpClient
     986           0 :                             = mpViewSh->GetViewShell()->GetIPClient();
     987           0 :                         if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
     988           0 :                             nOptions |= SDRINSERT_DONTMARK;
     989             :                     }
     990             : 
     991           0 :                     InsertObjectAtView( pObj, *pPV, nOptions );
     992             : 
     993           0 :                     if( pImageMap )
     994           0 :                         pObj->AppendUserData( new SdIMapInfo( *pImageMap ) );
     995             : 
     996           0 :                     if ( pObj && pObj->IsChart() )
     997             :                     {
     998           0 :                         bool bDisableDataTableDialog = false;
     999           0 :                         svt::EmbeddedObjectRef::TryRunningState( xObj );
    1000           0 :                         uno::Reference< beans::XPropertySet > xProps( xObj->getComponent(), uno::UNO_QUERY );
    1001           0 :                         if ( xProps.is() &&
    1002           0 :                              ( xProps->getPropertyValue( "DisableDataTableDialog" ) >>= bDisableDataTableDialog ) &&
    1003             :                              bDisableDataTableDialog )
    1004             :                         {
    1005           0 :                             xProps->setPropertyValue( "DisableDataTableDialog" , uno::makeAny( sal_False ) );
    1006           0 :                             xProps->setPropertyValue( "DisableComplexChartTypes" , uno::makeAny( sal_False ) );
    1007           0 :                             uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY );
    1008           0 :                             if ( xModifiable.is() )
    1009             :                             {
    1010           0 :                                 xModifiable->setModified( sal_True );
    1011           0 :                             }
    1012           0 :                         }
    1013             :                     }
    1014             : 
    1015           0 :                     bReturn = true;
    1016           0 :                 }
    1017             :             }
    1018           0 :         }
    1019             :     }
    1020             : 
    1021           0 :     if(!bReturn &&
    1022           0 :         !bLink &&
    1023           0 :         (CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE) || CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBED_SOURCE_OLE)) &&
    1024           0 :         aDataHelper.HasFormat(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE))
    1025             :     {
    1026             :         // online insert ole if format is forced or no gdi metafile is available
    1027           0 :         if( (nFormat != 0) || !aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) )
    1028             :         {
    1029           0 :             uno::Reference < io::XInputStream > xStm;
    1030           0 :             TransferableObjectDescriptor    aObjDesc;
    1031             : 
    1032           0 :             if ( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE, aObjDesc ) )
    1033             :             {
    1034           0 :                 uno::Reference < embed::XEmbeddedObject > xObj;
    1035           0 :                 OUString aName;
    1036             : 
    1037           0 :                 xStm = aDataHelper.GetInputStream(nFormat ? nFormat : SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, OUString());
    1038           0 :                 if (!xStm.is())
    1039           0 :                     xStm = aDataHelper.GetInputStream(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, OUString());
    1040             : 
    1041           0 :                 if (xStm.is())
    1042             :                 {
    1043           0 :                     xObj = mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xStm, aName );
    1044             :                 }
    1045             :                 else
    1046             :                 {
    1047             :                     try
    1048             :                     {
    1049           0 :                         uno::Reference< embed::XStorage > xTmpStor = ::comphelper::OStorageHelper::GetTemporaryStorage();
    1050             :                         uno::Reference < embed::XEmbedObjectClipboardCreator > xClipboardCreator =
    1051           0 :                             embed::MSOLEObjectSystemCreator::create( ::comphelper::getProcessComponentContext() );
    1052             : 
    1053           0 :                         embed::InsertedObjectInfo aInfo = xClipboardCreator->createInstanceInitFromClipboard(
    1054             :                                                                 xTmpStor,
    1055             :                                                                 "DummyName" ,
    1056           0 :                                                                 uno::Sequence< beans::PropertyValue >() );
    1057             : 
    1058             :                         // TODO/LATER: in future InsertedObjectInfo will be used to get container related information
    1059             :                         // for example whether the object should be an iconified one
    1060           0 :                         xObj = aInfo.Object;
    1061           0 :                         if ( xObj.is() )
    1062           0 :                             mpDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName );
    1063             :                     }
    1064           0 :                     catch( uno::Exception& )
    1065             :                     {}
    1066             :                 }
    1067             : 
    1068           0 :                 if ( xObj.is() )
    1069             :                 {
    1070           0 :                     svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );
    1071             : 
    1072             :                     // try to get the replacement image from the clipboard
    1073           0 :                     Graphic aGraphic;
    1074           0 :                     sal_uLong nGrFormat = 0;
    1075             : 
    1076             : // (wg. Selection Manager bei Trustet Solaris)
    1077             : #ifndef SOLARIS
    1078           0 :                     if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
    1079           0 :                         nGrFormat = SOT_FORMATSTR_ID_SVXB;
    1080           0 :                     else if( aDataHelper.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
    1081           0 :                         nGrFormat = SOT_FORMAT_GDIMETAFILE;
    1082           0 :                     else if( aDataHelper.GetGraphic( FORMAT_BITMAP, aGraphic ) )
    1083           0 :                         nGrFormat = SOT_FORMAT_BITMAP;
    1084             : #endif
    1085             : 
    1086             :                     // insert replacement image ( if there is one ) into the object helper
    1087           0 :                     if ( nGrFormat )
    1088             :                     {
    1089           0 :                         datatransfer::DataFlavor aDataFlavor;
    1090           0 :                         SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
    1091           0 :                         aObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
    1092             :                     }
    1093             : 
    1094           0 :                     Size aSize;
    1095           0 :                     if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
    1096             :                     {
    1097           0 :                         if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
    1098           0 :                             aSize = aObjDesc.maSize;
    1099             :                         else
    1100             :                         {
    1101           0 :                             MapMode aMapMode( MAP_100TH_MM );
    1102           0 :                             aSize = aObjRef.GetSize( &aMapMode );
    1103             :                         }
    1104             :                     }
    1105             :                     else
    1106             :                     {
    1107           0 :                         MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
    1108             : 
    1109           0 :                         awt::Size aSz;
    1110             :                         try{
    1111           0 :                             aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
    1112             :                         }
    1113           0 :                         catch( embed::NoVisualAreaSizeException& )
    1114             :                         {
    1115             :                             // the default size will be set later
    1116             :                         }
    1117             : 
    1118           0 :                         if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
    1119             :                         {
    1120           0 :                             Size aTmp( OutputDevice::LogicToLogic( aObjDesc.maSize, MAP_100TH_MM, aMapUnit ) );
    1121           0 :                             if ( aSz.Width != aTmp.Width() || aSz.Height != aTmp.Height() )
    1122             :                             {
    1123           0 :                                 aSz.Width = aTmp.Width();
    1124           0 :                                 aSz.Height = aTmp.Height();
    1125           0 :                                 xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
    1126             :                             }
    1127             :                         }
    1128             : 
    1129           0 :                         aSize = Size( aSz.Width, aSz.Height );
    1130             : 
    1131           0 :                         if( !aSize.Width() || !aSize.Height() )
    1132             :                         {
    1133           0 :                             aSize = OutputDevice::LogicToLogic( Size(14100, 10000), MAP_100TH_MM, aMapUnit );
    1134           0 :                             aSz.Width = aSize.Width();
    1135           0 :                             aSz.Height = aSize.Height();
    1136           0 :                             xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
    1137             :                         }
    1138             : 
    1139           0 :                         aSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MAP_100TH_MM );
    1140             :                     }
    1141             : 
    1142           0 :                     Size aMaxSize( mrDoc.GetMaxObjSize() );
    1143             : 
    1144           0 :                     maDropPos.X() -= std::min( aSize.Width(), aMaxSize.Width() ) >> 1;
    1145           0 :                     maDropPos.Y() -= std::min( aSize.Height(), aMaxSize.Height() ) >> 1;
    1146             : 
    1147           0 :                     Rectangle       aRect( maDropPos, aSize );
    1148           0 :                     SdrOle2Obj*     pObj = new SdrOle2Obj( aObjRef, aName, aRect );
    1149           0 :                     SdrPageView*    pPV = GetSdrPageView();
    1150           0 :                     sal_uLong           nOptions = SDRINSERT_SETDEFLAYER;
    1151             : 
    1152           0 :                     if (mpViewSh!=NULL)
    1153             :                     {
    1154             :                         OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
    1155             :                         SfxInPlaceClient* pIpClient
    1156           0 :                             = mpViewSh->GetViewShell()->GetIPClient();
    1157           0 :                         if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
    1158           0 :                             nOptions |= SDRINSERT_DONTMARK;
    1159             :                     }
    1160             : 
    1161           0 :                     InsertObjectAtView( pObj, *pPV, nOptions );
    1162             : 
    1163           0 :                     if( pImageMap )
    1164           0 :                         pObj->AppendUserData( new SdIMapInfo( *pImageMap ) );
    1165             : 
    1166             :                     // let the object stay in loaded state after insertion
    1167           0 :                     pObj->Unload();
    1168           0 :                     bReturn = true;
    1169           0 :                 }
    1170           0 :             }
    1171             :         }
    1172             : 
    1173           0 :         if( !bReturn && aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) )
    1174             :         {
    1175             :             // if no object was inserted, insert a picture
    1176           0 :             InsertMetaFile( aDataHelper, rPos, pImageMap.get(), true );
    1177           0 :             bReturn = true;
    1178             :         }
    1179             :     }
    1180             : 
    1181           0 :     if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_SVXB))
    1182             :     {
    1183           0 :         SotStorageStreamRef xStm;
    1184             : 
    1185           0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_SVXB, xStm ) )
    1186             :         {
    1187           0 :             Point   aInsertPos( rPos );
    1188           0 :             Graphic aGraphic;
    1189             : 
    1190           0 :             ReadGraphic( *xStm, aGraphic );
    1191             : 
    1192           0 :             if( pOwnData && pOwnData->GetWorkDocument() )
    1193             :             {
    1194           0 :                 const SdDrawDocument*   pWorkModel = pOwnData->GetWorkDocument();
    1195           0 :                 SdrPage*                pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ?
    1196             :                                                     pWorkModel->GetSdPage( 0, PK_STANDARD ) :
    1197           0 :                                                     pWorkModel->GetPage( 0 ) );
    1198             : 
    1199           0 :                 pWorkPage->SetRectsDirty();
    1200             : 
    1201             :                 // #i120393# Clipboard data uses full object geometry range
    1202           0 :                 const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
    1203             : 
    1204           0 :                 aInsertPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
    1205           0 :                 aInsertPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
    1206             :             }
    1207             : 
    1208             :             // restrict movement to WorkArea
    1209             :             Size aImageMapSize = OutputDevice::LogicToLogic(aGraphic.GetPrefSize(),
    1210           0 :                 aGraphic.GetPrefMapMode(), MapMode(MAP_100TH_MM));
    1211             : 
    1212           0 :             ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea());
    1213             : 
    1214           0 :             InsertGraphic( aGraphic, mnAction, aInsertPos, NULL, pImageMap.get() );
    1215           0 :             bReturn = true;
    1216           0 :         }
    1217             :     }
    1218             : 
    1219           0 :     if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(FORMAT_GDIMETAFILE))
    1220             :     {
    1221           0 :         Point aInsertPos( rPos );
    1222             : 
    1223           0 :         if( pOwnData && pOwnData->GetWorkDocument() )
    1224             : 
    1225             :         {
    1226           0 :             const SdDrawDocument*   pWorkModel = pOwnData->GetWorkDocument();
    1227           0 :             SdrPage*                pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ?
    1228             :                                                 pWorkModel->GetSdPage( 0, PK_STANDARD ) :
    1229           0 :                                                 pWorkModel->GetPage( 0 ) );
    1230             : 
    1231           0 :             pWorkPage->SetRectsDirty();
    1232             : 
    1233             :             // #i120393# Clipboard data uses full object geometry range
    1234           0 :             const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
    1235             : 
    1236           0 :             aInsertPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
    1237           0 :             aInsertPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
    1238             :         }
    1239             : 
    1240           0 :         bReturn = InsertMetaFile( aDataHelper, aInsertPos, pImageMap.get(), nFormat == 0 );
    1241             :     }
    1242             : 
    1243           0 :     if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(FORMAT_BITMAP))
    1244             :     {
    1245           0 :         BitmapEx aBmpEx;
    1246             : 
    1247             :         // get basic Bitmap data
    1248           0 :         aDataHelper.GetBitmapEx(FORMAT_BITMAP, aBmpEx);
    1249             : 
    1250           0 :         if(aBmpEx.IsEmpty())
    1251             :         {
    1252             :             // if this did not work, try to get graphic formats and convert these to bitmap
    1253           0 :             Graphic aGraphic;
    1254             : 
    1255           0 :             if(aDataHelper.GetGraphic(FORMAT_GDIMETAFILE, aGraphic))
    1256             :             {
    1257           0 :                 aBmpEx = aGraphic.GetBitmapEx();
    1258             :             }
    1259           0 :             else if(aDataHelper.GetGraphic(SOT_FORMATSTR_ID_SVXB, aGraphic))
    1260             :             {
    1261           0 :                 aBmpEx = aGraphic.GetBitmapEx();
    1262             :             }
    1263           0 :             else if(aDataHelper.GetGraphic(FORMAT_BITMAP, aGraphic))
    1264             :             {
    1265           0 :                 aBmpEx = aGraphic.GetBitmapEx();
    1266           0 :             }
    1267             :         }
    1268             : 
    1269           0 :         if(!aBmpEx.IsEmpty())
    1270             :         {
    1271           0 :             Point aInsertPos( rPos );
    1272             : 
    1273           0 :             if( pOwnData && pOwnData->GetWorkDocument() )
    1274             :             {
    1275           0 :                 const SdDrawDocument*   pWorkModel = pOwnData->GetWorkDocument();
    1276           0 :                 SdrPage*                pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ?
    1277             :                                                     pWorkModel->GetSdPage( 0, PK_STANDARD ) :
    1278           0 :                                                     pWorkModel->GetPage( 0 ) );
    1279             : 
    1280           0 :                 pWorkPage->SetRectsDirty();
    1281             : 
    1282             :                 // #i120393# Clipboard data uses full object geometry range
    1283           0 :                 const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
    1284             : 
    1285           0 :                 aInsertPos.X() = pOwnData->GetStartPos().X() + ( aSize.Width() >> 1 );
    1286           0 :                 aInsertPos.Y() = pOwnData->GetStartPos().Y() + ( aSize.Height() >> 1 );
    1287             :             }
    1288             : 
    1289             :             // restrict movement to WorkArea
    1290           0 :             Size aImageMapSize(aBmpEx.GetPrefSize());
    1291           0 :             ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea());
    1292             : 
    1293           0 :             InsertGraphic( aBmpEx, mnAction, aInsertPos, NULL, pImageMap.get() );
    1294           0 :             bReturn = true;
    1295           0 :         }
    1296             :     }
    1297             : 
    1298           0 :     if(!bReturn && pPickObj && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_XFA ) )
    1299             :     {
    1300           0 :         SotStorageStreamRef xStm;
    1301             : 
    1302           0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_XFA, xStm ) )
    1303             :         {
    1304           0 :             XFillExchangeData aFillData( XFillAttrSetItem( &mrDoc.GetPool() ) );
    1305             : 
    1306           0 :             ReadXFillExchangeData( *xStm, aFillData );
    1307             : 
    1308           0 :             if( IsUndoEnabled() )
    1309             :             {
    1310           0 :                 BegUndo( SD_RESSTR(STR_UNDO_DRAGDROP) );
    1311           0 :                 AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pPickObj ) );
    1312           0 :                 EndUndo();
    1313             :             }
    1314             : 
    1315           0 :             XFillAttrSetItem*   pSetItem = aFillData.GetXFillAttrSetItem();
    1316           0 :             SfxItemSet          rSet = pSetItem->GetItemSet();
    1317           0 :             drawing::FillStyle eFill= ( (XFillStyleItem&) rSet.Get( XATTR_FILLSTYLE ) ).GetValue();
    1318             : 
    1319           0 :             if( eFill == drawing::FillStyle_SOLID || eFill == drawing::FillStyle_NONE )
    1320             :             {
    1321           0 :                 const XFillColorItem&   rColItem = (XFillColorItem&) rSet.Get( XATTR_FILLCOLOR );
    1322           0 :                 Color                   aColor( rColItem.GetColorValue() );
    1323           0 :                 OUString                aName( rColItem.GetName() );
    1324           0 :                 SfxItemSet              aSet( mrDoc.GetPool() );
    1325           0 :                 bool                    bClosed = pPickObj->IsClosedObj();
    1326           0 :                 ::sd::Window* pWin = mpViewSh->GetActiveWindow();
    1327             :                 sal_uInt16 nHitLog = (sal_uInt16) pWin->PixelToLogic(
    1328           0 :                     Size(FuPoor::HITPIX, 0 ) ).Width();
    1329           0 :                 const long              n2HitLog = nHitLog << 1;
    1330           0 :                 Point                   aHitPosR( rPos );
    1331           0 :                 Point                   aHitPosL( rPos );
    1332           0 :                 Point                   aHitPosT( rPos );
    1333           0 :                 Point                   aHitPosB( rPos );
    1334           0 :                 const SetOfByte*        pVisiLayer = &GetSdrPageView()->GetVisibleLayers();
    1335             : 
    1336           0 :                 aHitPosR.X() += n2HitLog;
    1337           0 :                 aHitPosL.X() -= n2HitLog;
    1338           0 :                 aHitPosT.Y() += n2HitLog;
    1339           0 :                 aHitPosB.Y() -= n2HitLog;
    1340             : 
    1341           0 :                 if( bClosed &&
    1342           0 :                     SdrObjectPrimitiveHit(*pPickObj, aHitPosR, nHitLog, *GetSdrPageView(), pVisiLayer, false) &&
    1343           0 :                     SdrObjectPrimitiveHit(*pPickObj, aHitPosL, nHitLog, *GetSdrPageView(), pVisiLayer, false) &&
    1344           0 :                     SdrObjectPrimitiveHit(*pPickObj, aHitPosT, nHitLog, *GetSdrPageView(), pVisiLayer, false) &&
    1345           0 :                     SdrObjectPrimitiveHit(*pPickObj, aHitPosB, nHitLog, *GetSdrPageView(), pVisiLayer, false) )
    1346             :                 {
    1347             :                     // area fill
    1348           0 :                     if(eFill == drawing::FillStyle_SOLID )
    1349           0 :                         aSet.Put(XFillColorItem(aName, aColor));
    1350             : 
    1351           0 :                     aSet.Put( XFillStyleItem( eFill ) );
    1352             :                 }
    1353             :                 else
    1354           0 :                     aSet.Put( XLineColorItem( aName, aColor ) );
    1355             : 
    1356             :                 // add text color
    1357           0 :                 pPickObj->SetMergedItemSetAndBroadcast( aSet );
    1358             :             }
    1359           0 :             bReturn = true;
    1360           0 :         }
    1361             :     }
    1362             : 
    1363           0 :     if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_HTML))
    1364             :     {
    1365           0 :         SotStorageStreamRef xStm;
    1366             : 
    1367           0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_HTML, xStm ) )
    1368             :         {
    1369           0 :             xStm->Seek( 0 );
    1370             :             // mba: clipboard always must contain absolute URLs (could be from alien source)
    1371           0 :             bReturn = SdrView::Paste( *xStm, OUString(), EE_FORMAT_HTML, maDropPos, pPage, nPasteOptions );
    1372           0 :         }
    1373             :     }
    1374             : 
    1375           0 :     if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EDITENGINE))
    1376             :     {
    1377           0 :         SotStorageStreamRef xStm;
    1378             : 
    1379           0 :         if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_EDITENGINE, xStm ) )
    1380             :         {
    1381           0 :             OutlinerView* pOLV = GetTextEditOutlinerView();
    1382             : 
    1383           0 :             xStm->Seek( 0 );
    1384             : 
    1385           0 :             if( pOLV )
    1386             :             {
    1387           0 :                 Rectangle   aRect( pOLV->GetOutputArea() );
    1388           0 :                    Point       aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
    1389             : 
    1390           0 :                 if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
    1391             :                 {
    1392             :                     // mba: clipboard always must contain absolute URLs (could be from alien source)
    1393           0 :                     pOLV->Read( *xStm, OUString(), EE_FORMAT_BIN, false, mpDocSh->GetHeaderAttributes() );
    1394           0 :                     bReturn = true;
    1395             :                 }
    1396             :             }
    1397             : 
    1398           0 :             if( !bReturn )
    1399             :                 // mba: clipboard always must contain absolute URLs (could be from alien source)
    1400           0 :                 bReturn = SdrView::Paste( *xStm, OUString(), EE_FORMAT_BIN, maDropPos, pPage, nPasteOptions );
    1401           0 :         }
    1402             :     }
    1403             : 
    1404           0 :     if(!bReturn && !bLink && CHECK_FORMAT_TRANS(FORMAT_RTF))
    1405             :     {
    1406           0 :         SotStorageStreamRef xStm;
    1407             : 
    1408           0 :         if( aDataHelper.GetSotStorageStream( FORMAT_RTF, xStm ) )
    1409             :         {
    1410           0 :             xStm->Seek( 0 );
    1411             : 
    1412           0 :             if( bTable )
    1413             :             {
    1414           0 :                 bReturn = PasteRTFTable( xStm, pPage, nPasteOptions );
    1415             :             }
    1416             :             else
    1417             :             {
    1418           0 :                 OutlinerView* pOLV = GetTextEditOutlinerView();
    1419             : 
    1420           0 :                 if( pOLV )
    1421             :                 {
    1422           0 :                     Rectangle   aRect( pOLV->GetOutputArea() );
    1423           0 :                        Point       aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
    1424             : 
    1425           0 :                     if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
    1426             :                     {
    1427             :                         // mba: clipboard always must contain absolute URLs (could be from alien source)
    1428           0 :                         pOLV->Read( *xStm, OUString(), EE_FORMAT_RTF, false, mpDocSh->GetHeaderAttributes() );
    1429           0 :                         bReturn = true;
    1430             :                     }
    1431             :                 }
    1432             : 
    1433           0 :                 if( !bReturn )
    1434             :                     // mba: clipboard always must contain absolute URLs (could be from alien source)
    1435           0 :                     bReturn = SdrView::Paste( *xStm, OUString(), EE_FORMAT_RTF, maDropPos, pPage, nPasteOptions );
    1436             :             }
    1437           0 :         }
    1438             :     }
    1439             : 
    1440           0 :     if(!bReturn && CHECK_FORMAT_TRANS(FORMAT_FILE_LIST))
    1441             :     {
    1442           0 :         FileList aDropFileList;
    1443             : 
    1444           0 :         if( aDataHelper.GetFileList( FORMAT_FILE_LIST, aDropFileList ) )
    1445             :         {
    1446           0 :             maDropFileVector.clear();
    1447             : 
    1448           0 :             for( sal_uLong i = 0, nCount = aDropFileList.Count(); i < nCount; i++ )
    1449           0 :                 maDropFileVector.push_back( aDropFileList.GetFile( i ) );
    1450             : 
    1451           0 :             maDropInsertFileTimer.Start();
    1452             :         }
    1453             : 
    1454           0 :         bReturn = true;
    1455             :     }
    1456             : 
    1457           0 :     if(!bReturn && CHECK_FORMAT_TRANS(FORMAT_FILE))
    1458             :     {
    1459           0 :         OUString aDropFile;
    1460             : 
    1461           0 :         if( aDataHelper.GetString( FORMAT_FILE, aDropFile ) )
    1462             :         {
    1463           0 :             maDropFileVector.clear();
    1464           0 :             maDropFileVector.push_back( aDropFile );
    1465           0 :             maDropInsertFileTimer.Start();
    1466             :         }
    1467             : 
    1468           0 :         bReturn = true;
    1469             :     }
    1470             : 
    1471           0 :     if(!bReturn && !bLink && CHECK_FORMAT_TRANS(FORMAT_STRING))
    1472             :     {
    1473           0 :         if( ( FORMAT_STRING == nFormat ) ||
    1474           0 :             ( !aDataHelper.HasFormat( SOT_FORMATSTR_ID_SOLK ) &&
    1475           0 :               !aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
    1476           0 :               !aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILENAME ) ) )
    1477             :         {
    1478           0 :             OUString aOUString;
    1479             : 
    1480           0 :             if( aDataHelper.GetString( FORMAT_STRING, aOUString ) )
    1481             :             {
    1482           0 :                 OutlinerView* pOLV = GetTextEditOutlinerView();
    1483             : 
    1484           0 :                 if( pOLV )
    1485             :                 {
    1486           0 :                     pOLV->InsertText( aOUString );
    1487           0 :                     bReturn = true;
    1488             :                 }
    1489             : 
    1490           0 :                 if( !bReturn )
    1491           0 :                     bReturn = SdrView::Paste( aOUString, maDropPos, pPage, nPasteOptions );
    1492           0 :             }
    1493             :         }
    1494             :     }
    1495             : 
    1496           0 :     MarkListHasChanged();
    1497           0 :     mbIsDropAllowed = true;
    1498           0 :     rDnDAction = mnAction;
    1499             : 
    1500           0 :     return bReturn;
    1501             : }
    1502             : 
    1503           0 : bool View::PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions )
    1504             : {
    1505           0 :     boost::scoped_ptr<SdDrawDocument> pModel(new SdDrawDocument( DOCUMENT_TYPE_IMPRESS, mpDocSh ));
    1506           0 :     pModel->NewOrLoadCompleted(NEW_DOC);
    1507           0 :     pModel->GetItemPool().SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
    1508           0 :     pModel->InsertPage(pModel->AllocPage(false));
    1509             : 
    1510           0 :     Reference< XComponent > xComponent( new SdXImpressDocument( pModel.get(), true ) );
    1511           0 :     pModel->setUnoModel( Reference< XInterface >::query( xComponent ) );
    1512             : 
    1513           0 :     CreateTableFromRTF( *xStm, pModel.get() );
    1514           0 :     bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions, OUString(), OUString());
    1515             : 
    1516           0 :     xComponent->dispose();
    1517           0 :     xComponent.clear();
    1518             : 
    1519           0 :     return bRet;
    1520             : }
    1521             : 
    1522         114 : } // end of namespace sd
    1523             : 
    1524             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10