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

Generated by: LCOV version 1.10