LCOV - code coverage report
Current view: top level - sw/source/ui/dochdl - swdtflvr.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 95 1760 5.4 %
Date: 2012-08-25 Functions: 13 63 20.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 78 3909 2.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <com/sun/star/embed/XVisualObject.hpp>
      30                 :            : #include <com/sun/star/embed/XTransactedObject.hpp>
      31                 :            : #include <com/sun/star/embed/Aspects.hpp>
      32                 :            : #include <com/sun/star/embed/XEmbedObjectClipboardCreator.hpp>
      33                 :            : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
      34                 :            : 
      35                 :            : #include <svtools/embedtransfer.hxx>
      36                 :            : #include <svtools/insdlg.hxx>
      37                 :            : #include <unotools/tempfile.hxx>
      38                 :            : #include <comphelper/processfactory.hxx>
      39                 :            : #include <comphelper/servicehelper.hxx>
      40                 :            : #include <comphelper/storagehelper.hxx>
      41                 :            : #include <comphelper/string.hxx>
      42                 :            : #include <unotools/ucbstreamhelper.hxx>
      43                 :            : #include <sot/filelist.hxx>
      44                 :            : #include <svx/svxdlg.hxx>
      45                 :            : #include <toolkit/helper/vclunohelper.hxx>
      46                 :            : #include <osl/endian.h>
      47                 :            : #include <sfx2/linkmgr.hxx>
      48                 :            : #include <tools/urlobj.hxx>
      49                 :            : #include <vcl/wrkwin.hxx>
      50                 :            : #include <vcl/msgbox.hxx>
      51                 :            : #include <sfx2/dispatch.hxx>
      52                 :            : #include <svl/stritem.hxx>
      53                 :            : #include <svtools/imap.hxx>
      54                 :            : #include <sot/storage.hxx>
      55                 :            : #include <vcl/graph.hxx>
      56                 :            : #include <svl/urihelper.hxx>
      57                 :            : #include <svx/svdmodel.hxx>
      58                 :            : #include <svx/xexch.hxx>
      59                 :            : #include <svx/xmlexchg.hxx>
      60                 :            : #include <svx/dbaexchange.hxx>
      61                 :            : #include <svx/clipfmtitem.hxx>
      62                 :            : #include <sfx2/mieclip.hxx>
      63                 :            : #include <svx/svdetc.hxx>
      64                 :            : #include <svx/xoutbmp.hxx>
      65                 :            : #include <svl/urlbmk.hxx>
      66                 :            : #include <svtools/htmlout.hxx>
      67                 :            : #include <svx/hlnkitem.hxx>
      68                 :            : #include <svtools/inetimg.hxx>
      69                 :            : #include <editeng/paperinf.hxx>
      70                 :            : #include <svx/fmview.hxx>
      71                 :            : #include <editeng/scripttypeitem.hxx>
      72                 :            : #include <sfx2/docfilt.hxx>
      73                 :            : #include <svtools/imapobj.hxx>
      74                 :            : #include <sfx2/docfile.hxx>
      75                 :            : #include <unotools/transliterationwrapper.hxx>
      76                 :            : #include <unotools/streamwrap.hxx>
      77                 :            : #include <svtools/filter.hxx>
      78                 :            : 
      79                 :            : #include <svx/unomodel.hxx>
      80                 :            : #include <fmturl.hxx>
      81                 :            : #include <fmtinfmt.hxx>
      82                 :            : #include <fmtfsize.hxx>
      83                 :            : #include <swdtflvr.hxx>
      84                 :            : #include <shellio.hxx>
      85                 :            : #include <ddefld.hxx>
      86                 :            : #include <doc.hxx>
      87                 :            : #include <IDocumentUndoRedo.hxx>
      88                 :            : #include <pagedesc.hxx>
      89                 :            : #include <IMark.hxx>
      90                 :            : #include <docary.hxx>
      91                 :            : #include <section.hxx>
      92                 :            : #include <ndtxt.hxx>
      93                 :            : #include <edtwin.hxx>
      94                 :            : #include <navicont.hxx>
      95                 :            : #include <swcont.hxx>
      96                 :            : #include <wrtsh.hxx>
      97                 :            : #include <swmodule.hxx>
      98                 :            : #include <view.hxx>
      99                 :            : #include <docsh.hxx>
     100                 :            : #include <wdocsh.hxx>
     101                 :            : #include <fldbas.hxx>       //DDE
     102                 :            : #include <swundo.hxx>       // for Undo-Ids
     103                 :            : #include <pam.hxx>
     104                 :            : #include <ndole.hxx>
     105                 :            : #include <swwait.hxx>
     106                 :            : #include <viewopt.hxx>
     107                 :            : #include <swerror.h>
     108                 :            : #include <SwCapObjType.hxx>
     109                 :            : #include <cmdid.h>
     110                 :            : #include <dochdl.hrc>
     111                 :            : #include <comcore.hrc> // #111827#
     112                 :            : #include <sot/stg.hxx>
     113                 :            : #include <svx/svditer.hxx>
     114                 :            : #include <editeng/eeitem.hxx>
     115                 :            : #include <editeng/fhgtitem.hxx>
     116                 :            : #include <svx/svdpage.hxx>
     117                 :            : #include <avmedia/mediawindow.hxx>
     118                 :            : #include <swcrsr.hxx>
     119                 :            : #include <SwRewriter.hxx>
     120                 :            : #include <globals.hrc>
     121                 :            : #include <osl/mutex.hxx>
     122                 :            : #include <vcl/svapp.hxx>
     123                 :            : #include <swserv.hxx>
     124                 :            : #include <switerator.hxx>
     125                 :            : 
     126                 :            : extern sal_Bool bFrmDrag;
     127                 :            : extern sal_Bool bDDINetAttr;
     128                 :            : extern sal_Bool bExecuteDrag;
     129                 :            : 
     130                 :            : 
     131                 :            : #define OLESIZE 11905 - 2 * lMinBorder, 6 * MM50
     132                 :            : 
     133                 :            : #define SWTRANSFER_OBJECTTYPE_DRAWMODEL         0x00000001
     134                 :            : #define SWTRANSFER_OBJECTTYPE_HTML              0x00000002
     135                 :            : #define SWTRANSFER_OBJECTTYPE_RTF               0x00000004
     136                 :            : #define SWTRANSFER_OBJECTTYPE_STRING            0x00000008
     137                 :            : #define SWTRANSFER_OBJECTTYPE_SWOLE             0x00000010
     138                 :            : #define SWTRANSFER_OBJECTTYPE_DDE               0x00000020
     139                 :            : 
     140                 :            : #define SWTRANSFER_GRAPHIC_INSERTED             0x00000040
     141                 :            : 
     142                 :            : using namespace ::svx;
     143                 :            : using ::rtl::OUString;
     144                 :            : using namespace ::com::sun::star;
     145                 :            : using namespace ::com::sun::star::uno;
     146                 :            : using namespace ::com::sun::star::datatransfer;
     147                 :            : using namespace nsTransferBufferType;
     148                 :            : 
     149                 :            : #define DDE_TXT_ENCODING    osl_getThreadTextEncoding()
     150                 :            : 
     151                 :            : class SwTrnsfrDdeLink : public ::sfx2::SvBaseLink
     152                 :            : {
     153                 :            :     String sName;
     154                 :            :     ::sfx2::SvLinkSourceRef refObj;
     155                 :            :     SwTransferable& rTrnsfr;
     156                 :            :     SwDocShell* pDocShell;
     157                 :            :     sal_uLong nOldTimeOut;
     158                 :            :     sal_Bool bDelBookmrk : 1;
     159                 :            :     sal_Bool bInDisconnect : 1;
     160                 :            : 
     161                 :            :     sal_Bool FindDocShell();
     162                 :            : 
     163                 :            :     using sfx2::SvBaseLink::Disconnect;
     164                 :            : 
     165                 :            : protected:
     166                 :            :     virtual ~SwTrnsfrDdeLink();
     167                 :            : 
     168                 :            : public:
     169                 :            :     SwTrnsfrDdeLink( SwTransferable& rTrans, SwWrtShell& rSh );
     170                 :            : 
     171                 :            :     virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
     172                 :            :         const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
     173                 :            :     virtual void Closed();
     174                 :            : 
     175                 :            :     sal_Bool WriteData( SvStream& rStrm );
     176                 :            : 
     177                 :            :     void Disconnect( sal_Bool bRemoveDataAdvise );
     178                 :            : };
     179                 :            : 
     180                 :            : // helper class for Action and Undo enclosing
     181                 :            : class SwTrnsfrActionAndUndo
     182                 :            : {
     183                 :            :     SwWrtShell *pSh;
     184                 :            :     SwUndoId eUndoId;
     185                 :            : public:
     186                 :          0 :     SwTrnsfrActionAndUndo( SwWrtShell *pS, SwUndoId nId,
     187                 :            :                            const SwRewriter * pRewriter = 0,
     188                 :            :                            sal_Bool bDelSel = sal_False)
     189                 :          0 :         : pSh( pS ), eUndoId( nId )
     190                 :            :     {
     191                 :          0 :         pSh->StartUndo( eUndoId, pRewriter );
     192         [ #  # ]:          0 :         if( bDelSel )
     193                 :          0 :             pSh->DelRight();
     194                 :          0 :         pSh->StartAllAction();
     195                 :          0 :     }
     196                 :          0 :     ~SwTrnsfrActionAndUndo()
     197                 :            :     {
     198                 :          0 :         pSh->EndUndo();
     199                 :          0 :         pSh->EndAllAction();
     200                 :          0 :     }
     201                 :            : };
     202                 :            : 
     203                 :         20 : SwTransferable::SwTransferable( SwWrtShell& rSh )
     204                 :            :     : pWrtShell( &rSh ),
     205                 :            :     pCreatorView( 0 ),
     206                 :            :     pClpDocFac( 0 ),
     207                 :            :     pClpGraphic( 0 ),
     208                 :            :     pClpBitmap( 0 ),
     209                 :            :     pOrigGrf( 0 ),
     210                 :            :     pBkmk( 0 ),
     211                 :            :     pImageMap( 0 ),
     212                 :            :     pTargetURL( 0 ),
     213 [ +  - ][ +  - ]:         20 :     eBufferType( TRNSFR_NONE )
     214                 :            : {
     215         [ +  - ]:         20 :     rSh.GetView().AddTransferable(*this);
     216                 :         20 :     SwDocShell* pDShell = rSh.GetDoc()->GetDocShell();
     217         [ +  - ]:         20 :     if( pDShell )
     218                 :            :     {
     219         [ +  - ]:         20 :         pDShell->FillTransferableObjectDescriptor( aObjDesc );
     220         [ +  - ]:         20 :         if( pDShell->GetMedium() )
     221                 :            :         {
     222         [ +  - ]:         20 :             const INetURLObject& rURLObj = pDShell->GetMedium()->GetURLObject();
     223                 :            :             aObjDesc.maDisplayName = URIHelper::removePassword(
     224                 :            :                                 rURLObj.GetMainURL( INetURLObject::NO_DECODE ),
     225                 :            :                                 INetURLObject::WAS_ENCODED,
     226 [ +  - ][ +  - ]:         20 :                                    INetURLObject::DECODE_UNAMBIGUOUS );
                 [ +  - ]
     227                 :            :         }
     228                 :            : 
     229         [ +  - ]:         20 :         PrepareOLE( aObjDesc );
     230                 :            :     }
     231                 :         20 : }
     232                 :            : 
     233 [ +  - ][ +  - ]:         20 : SwTransferable::~SwTransferable()
         [ +  - ][ +  - ]
     234                 :            : {
     235 [ +  - ][ +  - ]:         20 :     Application::GetSolarMutex().acquire();
     236                 :            : 
     237                 :            :     // the DDELink still needs the WrtShell!
     238         [ -  + ]:         20 :     if( refDdeLink.Is() )
     239                 :            :     {
     240         [ #  # ]:          0 :         ((SwTrnsfrDdeLink*)&refDdeLink)->Disconnect( sal_True );
     241         [ #  # ]:          0 :         refDdeLink.Clear();
     242                 :            :     }
     243                 :            : 
     244                 :         20 :     pWrtShell = 0;
     245                 :            : 
     246                 :            :     // release reference to the document so that aDocShellRef will delete
     247                 :            :     // it (if aDocShellRef is set). Otherwise, the OLE nodes keep references
     248                 :            :     // to their sub-storage when the storage is already dead.
     249 [ -  + ][ #  # ]:         20 :     delete pClpDocFac;
     250                 :            : 
     251                 :            :     // first close, then the Ref. can be cleared as well, so that
     252                 :            :     // the DocShell really gets deleted!
     253         [ -  + ]:         20 :     if( aDocShellRef.Is() )
     254                 :            :     {
     255                 :          0 :         SfxObjectShell * pObj = aDocShellRef;
     256                 :          0 :         SwDocShell* pDocSh = (SwDocShell*)pObj;
     257         [ #  # ]:          0 :         pDocSh->DoClose();
     258                 :            :     }
     259         [ +  - ]:         20 :     aDocShellRef.Clear();
     260                 :            : 
     261         [ +  - ]:         20 :     SwModule* pMod = SW_MOD();
     262         [ +  - ]:         20 :     if(pMod)
     263                 :            :     {
     264         [ -  + ]:         20 :         if ( pMod->pDragDrop == this )
     265                 :          0 :             pMod->pDragDrop = 0;
     266         [ -  + ]:         20 :         else if ( pMod->pXSelection == this )
     267                 :          0 :             pMod->pXSelection = 0;
     268                 :            :     }
     269                 :            : 
     270 [ -  + ][ #  # ]:         20 :     delete pClpGraphic;
     271 [ -  + ][ #  # ]:         20 :     delete pClpBitmap;
     272 [ -  + ][ #  # ]:         20 :     delete pImageMap;
     273 [ -  + ][ #  # ]:         20 :     delete pTargetURL;
     274 [ -  + ][ #  # ]:         20 :     delete pBkmk;
     275                 :            : 
     276                 :            : 
     277                 :         20 :     eBufferType = TRNSFR_NONE;
     278                 :            : 
     279 [ +  - ][ +  - ]:         20 :     Application::GetSolarMutex().release();
     280         [ -  + ]:         40 : }
     281                 :            : 
     282                 :          0 : static SwDoc * lcl_GetDoc(SwDocFac & rDocFac)
     283                 :            : {
     284                 :          0 :     SwDoc *const pDoc = rDocFac.GetDoc();
     285                 :            :     OSL_ENSURE( pDoc, "Document not found" );
     286         [ #  # ]:          0 :     if (pDoc)
     287                 :            :     {
     288                 :          0 :         pDoc->SetClipBoard( true );
     289                 :            :     }
     290                 :          0 :     return pDoc;
     291                 :            : }
     292                 :            : 
     293                 :         20 : void SwTransferable::ObjectReleased()
     294                 :            : {
     295                 :         20 :     SwModule *pMod = SW_MOD();
     296         [ -  + ]:         20 :     if( this == pMod->pDragDrop )
     297                 :          0 :         pMod->pDragDrop = 0;
     298         [ +  - ]:         20 :     else if( this == pMod->pXSelection )
     299                 :         20 :         pMod->pXSelection = 0;
     300                 :         20 : }
     301                 :            : 
     302                 :          0 : void SwTransferable::AddSupportedFormats()
     303                 :            : {
     304                 :            :     // only need if we are the current XSelection Object
     305                 :          0 :     SwModule *pMod = SW_MOD();
     306         [ #  # ]:          0 :     if( this == pMod->pXSelection )
     307                 :            :     {
     308         [ #  # ]:          0 :         SetDataForDragAndDrop( Point( 0,0) );
     309                 :            :     }
     310                 :          0 : }
     311                 :            : 
     312                 :        111 : void SwTransferable::InitOle( SfxObjectShell* pDoc, SwDoc& rDoc )
     313                 :            : {
     314                 :            :     //set OleVisArea. Upper left corner of the page and size of
     315                 :            :     //RealSize in Twips.
     316                 :        111 :     const Size aSz( OLESIZE );
     317                 :        111 :     SwRect aVis( Point( DOCUMENTBORDER, DOCUMENTBORDER ), aSz );
     318 [ +  - ][ +  - ]:        111 :     pDoc->SetVisArea( aVis.SVRect() );
     319         [ +  - ]:        111 :     rDoc.set(IDocumentSettingAccess::BROWSE_MODE, true );
     320                 :        111 : }
     321                 :            : 
     322                 :          0 : uno::Reference < embed::XEmbeddedObject > SwTransferable::FindOLEObj( sal_Int64& nAspect ) const
     323                 :            : {
     324                 :          0 :     uno::Reference < embed::XEmbeddedObject > xObj;
     325         [ #  # ]:          0 :     if( pClpDocFac )
     326                 :            :     {
     327 [ #  # ][ #  # ]:          0 :         SwIterator<SwCntntNode,SwFmtColl> aIter( *pClpDocFac->GetDoc()->GetDfltGrfFmtColl() );
     328 [ #  # ][ #  # ]:          0 :         for( SwCntntNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
                 [ #  # ]
     329         [ #  # ]:          0 :             if( ND_OLENODE == pNd->GetNodeType() )
     330                 :            :             {
     331 [ #  # ][ #  # ]:          0 :                 xObj = ((SwOLENode*)pNd)->GetOLEObj().GetOleRef();
     332         [ #  # ]:          0 :                 nAspect = ((SwOLENode*)pNd)->GetAspect();
     333                 :          0 :                 break;
     334         [ #  # ]:          0 :             }
     335                 :            :     }
     336                 :          0 :     return xObj;
     337                 :            : }
     338                 :            : 
     339                 :          0 : Graphic* SwTransferable::FindOLEReplacementGraphic() const
     340                 :            : {
     341         [ #  # ]:          0 :     if( pClpDocFac )
     342                 :            :     {
     343 [ #  # ][ #  # ]:          0 :         SwIterator<SwCntntNode,SwFmtColl> aIter( *pClpDocFac->GetDoc()->GetDfltGrfFmtColl() );
     344 [ #  # ][ #  # ]:          0 :         for( SwCntntNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
                 [ #  # ]
     345         [ #  # ]:          0 :             if( ND_OLENODE == pNd->GetNodeType() )
     346                 :            :             {
     347         [ #  # ]:          0 :                 return ((SwOLENode*)pNd)->GetGraphic();
     348 [ #  # ][ #  # ]:          0 :             }
     349                 :            :     }
     350                 :            : 
     351                 :          0 :     return NULL;
     352                 :            : }
     353                 :            : 
     354                 :          0 : void SwTransferable::RemoveDDELinkFormat( const Window& rWin )
     355                 :            : {
     356                 :          0 :     RemoveFormat( SOT_FORMATSTR_ID_LINK );
     357                 :          0 :     CopyToClipboard( (Window*)&rWin );
     358                 :          0 : }
     359                 :            : 
     360                 :            : namespace
     361                 :            : {
     362                 :            :     //Resolves: fdo#40717 surely when we create a clipboard document we should
     363                 :            :     //overwrite the clipboard documents styles and settings with that of the
     364                 :            :     //source, so that we can WYSIWYG paste. If we want that the destinations
     365                 :            :     //styles are used over the source styles, that's a matter of the
     366                 :            :     //destination paste code to handle, not the source paste code.
     367                 :          0 :     void lclOverWriteDoc(SwWrtShell &rSrcWrtShell, SwDoc &rDest)
     368                 :            :     {
     369                 :          0 :         const SwDoc &rSrc = *rSrcWrtShell.GetDoc();
     370                 :            : 
     371                 :          0 :         rDest.ReplaceCompatabilityOptions(rSrc);
     372                 :          0 :         rDest.ReplaceDefaults(rSrc);
     373                 :            : 
     374                 :            :         //It would probably make most sense here to only insert the styles used
     375                 :            :         //by the selection, e.g. apply SwDoc::IsUsed on styles ?
     376                 :          0 :         rDest.ReplaceStyles(rSrc, false);
     377                 :            : 
     378                 :          0 :         rSrcWrtShell.Copy(&rDest);
     379                 :          0 :     }
     380                 :            : }
     381                 :            : 
     382                 :          0 : sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor )
     383                 :            : {
     384                 :          0 :     sal_uInt32  nFormat = SotExchange::GetFormat( rFlavor );
     385                 :            : 
     386                 :            :     // we can only fullfil the request if
     387                 :            :     // 1) we have data for this format
     388                 :            :     // 2) we have either a clipboard document (pClpDocFac), or
     389                 :            :     //    we have a SwWrtShell (so we can generate a new clipboard document)
     390 [ #  # ][ #  # ]:          0 :     if( !HasFormat( nFormat ) || ( pClpDocFac == NULL && pWrtShell == NULL ) )
         [ #  # ][ #  # ]
     391                 :          0 :         return sal_False;
     392                 :            : 
     393         [ #  # ]:          0 :     if( !pClpDocFac )
     394                 :            :     {
     395                 :          0 :         SelectionType nSelectionType = pWrtShell->GetSelectionType();
     396                 :            : 
     397                 :            : // SEL_GRF comes from ContentType of editsh
     398         [ #  # ]:          0 :         if( (nsSelectionType::SEL_GRF | nsSelectionType::SEL_DRW_FORM) & nSelectionType )
     399                 :            :         {
     400 [ #  # ][ #  # ]:          0 :             pClpGraphic = new Graphic;
     401 [ #  # ][ #  # ]:          0 :             if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic ))
     402                 :          0 :                 pOrigGrf = pClpGraphic;
     403 [ #  # ][ #  # ]:          0 :             pClpBitmap = new Graphic;
     404 [ #  # ][ #  # ]:          0 :             if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap ))
     405                 :          0 :                 pOrigGrf = pClpBitmap;
     406                 :            : 
     407                 :            :             // is it an URL-Button ?
     408 [ #  # ][ #  # ]:          0 :             String sURL, sDesc;
     409 [ #  # ][ #  # ]:          0 :             if( pWrtShell->GetURLFromButton( sURL, sDesc ) )
     410                 :            :             {
     411 [ #  # ][ #  # ]:          0 :                 pBkmk = new INetBookmark( sURL, sDesc );
     412                 :          0 :                 eBufferType = TRNSFR_INETFLD;
     413 [ #  # ][ #  # ]:          0 :             }
     414                 :            :         }
     415                 :            : 
     416         [ #  # ]:          0 :         pClpDocFac = new SwDocFac;
     417                 :          0 :         SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac);
     418                 :            : 
     419                 :          0 :         pTmpDoc->LockExpFlds();     // never update fields - leave text as it is
     420                 :          0 :         lclOverWriteDoc(*pWrtShell, *pTmpDoc);
     421                 :            : 
     422                 :            :         // in CORE a new one was created (OLE-Objekte copied!)
     423         [ #  # ]:          0 :         aDocShellRef = pTmpDoc->GetTmpDocShell();
     424         [ #  # ]:          0 :         if( aDocShellRef.Is() )
     425                 :          0 :             SwTransferable::InitOle( aDocShellRef, *pTmpDoc );
     426         [ #  # ]:          0 :         pTmpDoc->SetTmpDocShell( (SfxObjectShell*)NULL );
     427                 :            : 
     428 [ #  # ][ #  # ]:          0 :         if( nSelectionType & nsSelectionType::SEL_TXT && !pWrtShell->HasMark() )
                 [ #  # ]
     429                 :            :         {
     430         [ #  # ]:          0 :             SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR );
     431                 :            : 
     432                 :          0 :             Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY());
     433                 :            : 
     434                 :            :             sal_Bool bSelect = bExecuteDrag &&
     435         [ #  # ]:          0 :                             pWrtShell->GetView().GetDocShell() &&
     436 [ #  # ][ #  # ]:          0 :                             !pWrtShell->GetView().GetDocShell()->IsReadOnly();
         [ #  # ][ #  # ]
                 [ #  # ]
     437 [ #  # ][ #  # ]:          0 :             if( pWrtShell->GetContentAtPos( aPos, aCntntAtPos, bSelect ) )
     438                 :            :             {
     439                 :            :                 pBkmk = new INetBookmark(
     440                 :          0 :                         ((SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr)->GetValue(),
     441 [ #  # ][ #  # ]:          0 :                         aCntntAtPos.sStr );
     442                 :          0 :                 eBufferType = TRNSFR_INETFLD;
     443         [ #  # ]:          0 :                 if( bSelect )
     444         [ #  # ]:          0 :                     pWrtShell->SelectTxtAttr( RES_TXTATR_INETFMT );
     445         [ #  # ]:          0 :             }
     446                 :            :         }
     447         [ #  # ]:          0 :         if( pWrtShell->IsFrmSelected() )
     448                 :            :         {
     449 [ #  # ][ #  # ]:          0 :              SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_URL, RES_URL );
     450         [ #  # ]:          0 :             pWrtShell->GetFlyFrmAttr( aSet );
     451         [ #  # ]:          0 :             const SwFmtURL& rURL = (SwFmtURL&)aSet.Get( RES_URL );
     452         [ #  # ]:          0 :             if( rURL.GetMap() )
     453 [ #  # ][ #  # ]:          0 :                 pImageMap = new ImageMap( *rURL.GetMap() );
     454         [ #  # ]:          0 :             else if( rURL.GetURL().Len() )
     455                 :            :                 pTargetURL = new INetImage( aEmptyStr, rURL.GetURL(),
     456                 :            :                                             rURL.GetTargetFrameName(),
     457 [ #  # ][ #  # ]:          0 :                                             aEmptyStr, Size() );
                 [ #  # ]
     458                 :            :         }
     459                 :            :     }
     460                 :            : 
     461                 :          0 :     sal_Bool    bOK = sal_False;
     462         [ #  # ]:          0 :     if( TRNSFR_OLE == eBufferType )
     463                 :            :     {
     464                 :            :         //TODO/MBA: testing - is this the "single OLE object" case?!
     465                 :            :         // get OLE-Object from ClipDoc and get the data from that.
     466                 :          0 :         sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; // will be set in the next statement
     467         [ #  # ]:          0 :         uno::Reference < embed::XEmbeddedObject > xObj = FindOLEObj( nAspect );
     468         [ #  # ]:          0 :         Graphic* pOLEGraph = FindOLEReplacementGraphic();
     469         [ #  # ]:          0 :         if( xObj.is() )
     470                 :            :         {
     471 [ #  # ][ #  # ]:          0 :             TransferableDataHelper aD( new SvEmbedTransferHelper( xObj, pOLEGraph, nAspect ) );
         [ #  # ][ #  # ]
     472         [ #  # ]:          0 :             uno::Any aAny( aD.GetAny( rFlavor ));
     473         [ #  # ]:          0 :             if( aAny.hasValue() )
     474 [ #  # ][ #  # ]:          0 :                 bOK = SetAny( aAny, rFlavor );
     475                 :            :         }
     476                 :            : 
     477                 :            :         // the following solution will be used in the case when the object can not generate the image
     478                 :            :         // TODO/LATER: in future the transferhelper must probably be created based on object and the replacement stream
     479         [ #  # ]:          0 :         if ( nFormat == SOT_FORMAT_GDIMETAFILE )
     480                 :            :         {
     481         [ #  # ]:          0 :             pOLEGraph = FindOLEReplacementGraphic();
     482         [ #  # ]:          0 :             if ( pOLEGraph )
     483 [ #  # ][ #  # ]:          0 :                 bOK = SetGDIMetaFile( pOLEGraph->GetGDIMetaFile(), rFlavor );
     484                 :          0 :         }
     485                 :            :     }
     486                 :            :     else
     487                 :            :     {
     488   [ #  #  #  #  :          0 :         switch( nFormat )
          #  #  #  #  #  
             #  #  #  #  
                      # ]
     489                 :            :         {
     490                 :            :         case SOT_FORMATSTR_ID_LINK:
     491         [ #  # ]:          0 :             if( refDdeLink.Is() )
     492                 :          0 :                 bOK = SetObject( &refDdeLink,
     493                 :          0 :                                     SWTRANSFER_OBJECTTYPE_DDE, rFlavor );
     494                 :          0 :             break;
     495                 :            : 
     496                 :            :         case SOT_FORMATSTR_ID_OBJECTDESCRIPTOR:
     497                 :            :         case SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR:
     498                 :          0 :             bOK = SetTransferableObjectDescriptor( aObjDesc, rFlavor );
     499                 :          0 :             break;
     500                 :            : 
     501                 :            :         case SOT_FORMATSTR_ID_DRAWING:
     502                 :            :             {
     503                 :          0 :                 SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
     504                 :          0 :                 bOK = SetObject( pDoc->GetDrawModel(),
     505                 :          0 :                                 SWTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor );
     506                 :            :             }
     507                 :          0 :             break;
     508                 :            : 
     509                 :            :         case SOT_FORMAT_STRING:
     510                 :            :         {
     511                 :          0 :             SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
     512                 :          0 :             bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_STRING, rFlavor );
     513                 :            :         }
     514                 :          0 :         break;
     515                 :            :         case SOT_FORMAT_RTF:
     516                 :            :         {
     517                 :          0 :             SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
     518                 :          0 :             bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_RTF, rFlavor );
     519                 :            :         }
     520                 :          0 :             break;
     521                 :            : 
     522                 :            :         case SOT_FORMATSTR_ID_HTML:
     523                 :            :         {
     524                 :          0 :             SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
     525                 :          0 :             bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_HTML, rFlavor );
     526                 :            :         }
     527                 :          0 :             break;
     528                 :            : 
     529                 :            :         case SOT_FORMATSTR_ID_SVXB:
     530 [ #  # ][ #  # ]:          0 :             if( eBufferType & TRNSFR_GRAPHIC && pOrigGrf )
     531                 :          0 :                 bOK = SetGraphic( *pOrigGrf, rFlavor );
     532                 :          0 :             break;
     533                 :            : 
     534                 :            :         case SOT_FORMAT_GDIMETAFILE:
     535         [ #  # ]:          0 :             if( eBufferType & TRNSFR_GRAPHIC )
     536                 :          0 :                 bOK = SetGDIMetaFile( pClpGraphic->GetGDIMetaFile(), rFlavor );
     537                 :          0 :             break;
     538                 :            :         case SOT_FORMAT_BITMAP:
     539                 :            :             // Neither pClpBitmap nor pClpGraphic are necessarily set
     540 [ #  # ][ #  # ]:          0 :             if( (eBufferType & TRNSFR_GRAPHIC) && (pClpBitmap != 0 || pClpGraphic != 0))
                 [ #  # ]
     541                 :            :                 bOK = SetBitmap( (pClpBitmap ? pClpBitmap
     542                 :            :                                              : pClpGraphic)->GetBitmap(),
     543 [ #  # ][ #  # ]:          0 :                                  rFlavor );
         [ #  # ][ #  # ]
     544                 :          0 :             break;
     545                 :            : 
     546                 :            :         case SOT_FORMATSTR_ID_SVIM:
     547         [ #  # ]:          0 :             if( pImageMap )
     548                 :          0 :                 bOK = SetImageMap( *pImageMap, rFlavor );
     549                 :          0 :             break;
     550                 :            : 
     551                 :            :         case SOT_FORMATSTR_ID_INET_IMAGE:
     552         [ #  # ]:          0 :             if( pTargetURL )
     553                 :          0 :                 bOK = SetINetImage( *pTargetURL, rFlavor );
     554                 :          0 :             break;
     555                 :            : 
     556                 :            :         case SOT_FORMATSTR_ID_SOLK:
     557                 :            :         case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
     558                 :            :         case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR:
     559                 :            :         case SOT_FORMATSTR_ID_FILECONTENT:
     560                 :            :         case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR:
     561                 :            :         case SOT_FORMAT_FILE:
     562 [ #  # ][ #  # ]:          0 :             if( (TRNSFR_INETFLD & eBufferType) && pBkmk )
     563                 :          0 :                 bOK = SetINetBookmark( *pBkmk, rFlavor );
     564                 :          0 :             break;
     565                 :            : 
     566                 :            :         case SOT_FORMATSTR_ID_EMBED_SOURCE:
     567         [ #  # ]:          0 :             if( !aDocShellRef.Is() )
     568                 :            :             {
     569                 :          0 :                 SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
     570                 :            :                 SwDocShell* pNewDocSh = new SwDocShell( pDoc,
     571         [ #  # ]:          0 :                                          SFX_CREATE_MODE_EMBEDDED );
     572                 :          0 :                 aDocShellRef = pNewDocSh;
     573                 :          0 :                 aDocShellRef->DoInitNew( NULL );
     574                 :          0 :                 SwTransferable::InitOle( aDocShellRef, *pDoc );
     575                 :            :             }
     576                 :          0 :             bOK = SetObject( &aDocShellRef, SWTRANSFER_OBJECTTYPE_SWOLE,
     577                 :          0 :                             rFlavor );
     578                 :          0 :             break;
     579                 :            :         }
     580                 :            :     }
     581                 :          0 :     return bOK;
     582                 :            : }
     583                 :            : 
     584                 :          0 : sal_Bool SwTransferable::WriteObject( SotStorageStreamRef& xStream,
     585                 :            :                                     void* pObject, sal_uInt32 nObjectType,
     586                 :            :                                     const DATA_FLAVOR& /*rFlavor*/ )
     587                 :            : {
     588                 :          0 :     sal_Bool bRet = sal_False;
     589                 :          0 :     WriterRef xWrt;
     590                 :            : 
     591   [ #  #  #  #  :          0 :     switch( nObjectType )
                #  #  # ]
     592                 :            :     {
     593                 :            :     case SWTRANSFER_OBJECTTYPE_DRAWMODEL:
     594                 :            :         {
     595                 :            :             // dont change the sequence of commands
     596                 :          0 :             SdrModel *pModel = (SdrModel*)pObject;
     597         [ #  # ]:          0 :             xStream->SetBufferSize( 16348 );
     598                 :            : 
     599                 :            :             // for the changed pool defaults from drawing layer pool set those
     600                 :            :             // attributes as hard attributes to preserve them for saving
     601                 :          0 :             const SfxItemPool& rItemPool = pModel->GetItemPool();
     602         [ #  # ]:          0 :             const SvxFontHeightItem& rDefaultFontHeight = (const SvxFontHeightItem&)rItemPool.GetDefaultItem(EE_CHAR_FONTHEIGHT);
     603                 :            : 
     604                 :            :             // SW should have no MasterPages
     605                 :            :             OSL_ENSURE(0L == pModel->GetMasterPageCount(), "SW with MasterPages (!)");
     606                 :            : 
     607 [ #  # ][ #  # ]:          0 :             for(sal_uInt16 a(0); a < pModel->GetPageCount(); a++)
     608                 :            :             {
     609         [ #  # ]:          0 :                 const SdrPage* pPage = pModel->GetPage(a);
     610         [ #  # ]:          0 :                 SdrObjListIter aIter(*pPage, IM_DEEPNOGROUPS);
     611                 :            : 
     612         [ #  # ]:          0 :                 while(aIter.IsMore())
     613                 :            :                 {
     614         [ #  # ]:          0 :                     SdrObject* pObj = aIter.Next();
     615         [ #  # ]:          0 :                     const SvxFontHeightItem& rItem = (const SvxFontHeightItem&)pObj->GetMergedItem(EE_CHAR_FONTHEIGHT);
     616                 :            : 
     617         [ #  # ]:          0 :                     if(rItem.GetHeight() == rDefaultFontHeight.GetHeight())
     618                 :            :                     {
     619         [ #  # ]:          0 :                         pObj->SetMergedItem(rDefaultFontHeight);
     620                 :            :                     }
     621                 :            :                 }
     622                 :          0 :             }
     623                 :            : 
     624                 :            :             {
     625 [ #  # ][ #  # ]:          0 :                 uno::Reference<io::XOutputStream> xDocOut( new utl::OOutputStreamWrapper( *xStream ) );
                 [ #  # ]
     626 [ #  # ][ #  # ]:          0 :                 if( SvxDrawingLayerExport( pModel, xDocOut ) )
     627         [ #  # ]:          0 :                     xStream->Commit();
     628                 :            :             }
     629                 :            : 
     630                 :          0 :             bRet = ERRCODE_NONE == xStream->GetError();
     631                 :            :         }
     632                 :          0 :         break;
     633                 :            : 
     634                 :            :     case SWTRANSFER_OBJECTTYPE_SWOLE:
     635                 :            :         {
     636                 :          0 :             SfxObjectShell*   pEmbObj = (SfxObjectShell*) pObject;
     637                 :            :             try
     638                 :            :             {
     639         [ #  # ]:          0 :                 ::utl::TempFile     aTempFile;
     640                 :          0 :                 aTempFile.EnableKillingFile();
     641                 :            :                 uno::Reference< embed::XStorage > xWorkStore =
     642 [ #  # ][ #  # ]:          0 :                     ::comphelper::OStorageHelper::GetStorageFromURL( aTempFile.GetURL(), embed::ElementModes::READWRITE );
         [ #  # ][ #  # ]
     643                 :            : 
     644                 :            :                 // write document storage
     645         [ #  # ]:          0 :                 pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, sal_False );
     646                 :            :                 // mba: no BaseURL for clipboard
     647 [ #  # ][ #  # ]:          0 :                 SfxMedium aMedium( xWorkStore, String() );
                 [ #  # ]
     648         [ #  # ]:          0 :                 bRet = pEmbObj->DoSaveObjectAs( aMedium, sal_False );
     649         [ #  # ]:          0 :                 pEmbObj->DoSaveCompleted();
     650                 :            : 
     651         [ #  # ]:          0 :                 uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY );
     652         [ #  # ]:          0 :                 if ( xTransact.is() )
     653 [ #  # ][ #  # ]:          0 :                     xTransact->commit();
     654                 :            : 
     655 [ #  # ][ #  # ]:          0 :                 SvStream* pSrcStm = ::utl::UcbStreamHelper::CreateStream( aTempFile.GetURL(), STREAM_READ );
                 [ #  # ]
     656         [ #  # ]:          0 :                 if( pSrcStm )
     657                 :            :                 {
     658         [ #  # ]:          0 :                     xStream->SetBufferSize( 0xff00 );
     659         [ #  # ]:          0 :                     *xStream << *pSrcStm;
     660 [ #  # ][ #  # ]:          0 :                     delete pSrcStm;
     661                 :            :                 }
     662                 :            : 
     663                 :          0 :                 bRet = sal_True;
     664                 :            : 
     665 [ #  # ][ #  # ]:          0 :                 xWorkStore->dispose();
     666         [ #  # ]:          0 :                 xWorkStore = uno::Reference < embed::XStorage >();
     667 [ #  # ][ #  # ]:          0 :                 xStream->Commit();
         [ #  # ][ #  # ]
     668                 :            :             }
     669         [ #  # ]:          0 :             catch (const uno::Exception&)
     670                 :            :             {
     671                 :            :             }
     672                 :            : 
     673                 :          0 :             bRet = ( xStream->GetError() == ERRCODE_NONE );
     674                 :            :         }
     675                 :          0 :         break;
     676                 :            : 
     677                 :            : 
     678                 :            :     case SWTRANSFER_OBJECTTYPE_DDE:
     679                 :            :         {
     680         [ #  # ]:          0 :             xStream->SetBufferSize( 1024 );
     681                 :          0 :             SwTrnsfrDdeLink* pDdeLnk = (SwTrnsfrDdeLink*)pObject;
     682 [ #  # ][ #  # ]:          0 :             if( pDdeLnk->WriteData( *xStream ) )
     683                 :            :             {
     684         [ #  # ]:          0 :                 xStream->Commit();
     685                 :          0 :                 bRet = ERRCODE_NONE == xStream->GetError();
     686                 :            :             }
     687                 :            :         }
     688                 :          0 :         break;
     689                 :            : 
     690                 :            :     case SWTRANSFER_OBJECTTYPE_HTML:
     691 [ #  # ][ #  # ]:          0 :         GetHTMLWriter( aEmptyStr, String(), xWrt );
                 [ #  # ]
     692                 :          0 :         break;
     693                 :            : 
     694                 :            :     case SWTRANSFER_OBJECTTYPE_RTF:
     695 [ #  # ][ #  # ]:          0 :         GetRTFWriter( aEmptyStr, String(), xWrt );
                 [ #  # ]
     696                 :          0 :         break;
     697                 :            : 
     698                 :            :     case SWTRANSFER_OBJECTTYPE_STRING:
     699 [ #  # ][ #  # ]:          0 :         GetASCWriter( aEmptyStr, String(), xWrt );
                 [ #  # ]
     700         [ #  # ]:          0 :         if( xWrt.Is() )
     701                 :            :         {
     702         [ #  # ]:          0 :             SwAsciiOptions aAOpt;
     703                 :          0 :             aAOpt.SetCharSet( RTL_TEXTENCODING_UTF8 );
     704         [ #  # ]:          0 :             xWrt->SetAsciiOptions( aAOpt );
     705                 :            : 
     706                 :            :             // no start char for clipboard
     707         [ #  # ]:          0 :             xWrt->bUCS2_WithStartChar = sal_False;
     708                 :            :         }
     709                 :          0 :         break;
     710                 :            :     }
     711                 :            : 
     712         [ #  # ]:          0 :     if( xWrt.Is() )
     713                 :            :     {
     714                 :          0 :         SwDoc* pDoc = (SwDoc*)pObject;
     715                 :          0 :         xWrt->bWriteClipboardDoc = sal_True;
     716                 :          0 :         xWrt->bWriteOnlyFirstTable = 0 != (TRNSFR_TABELLE & eBufferType);
     717                 :          0 :         xWrt->SetShowProgress( sal_False );
     718                 :            : 
     719                 :            : #if defined(DEBUGPASTE)
     720                 :            :         SvFileStream aPasteDebug(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
     721                 :            :             "PASTEBUFFER.debug")), STREAM_WRITE|STREAM_TRUNC);
     722                 :            :         SwWriter aDbgWrt( aPasteDebug, *pDoc );
     723                 :            :         aDbgWrt.Write( xWrt );
     724                 :            : #endif
     725                 :            : 
     726         [ #  # ]:          0 :         SwWriter aWrt( *xStream, *pDoc );
     727 [ #  # ][ #  # ]:          0 :         if( !IsError( aWrt.Write( xWrt )) )
     728                 :            :         {
     729         [ #  # ]:          0 :             *xStream << '\0';               // terminate with a zero
     730         [ #  # ]:          0 :             xStream->Commit();
     731                 :          0 :             bRet = sal_True;
     732         [ #  # ]:          0 :         }
     733                 :            :     }
     734                 :            : 
     735         [ #  # ]:          0 :     return bRet;
     736                 :            : }
     737                 :            : 
     738                 :          0 : int SwTransferable::Cut()
     739                 :            : {
     740                 :          0 :     int nRet = Copy( sal_True );
     741         [ #  # ]:          0 :     if( nRet )
     742                 :          0 :         DeleteSelection();
     743                 :          0 :     return nRet;
     744                 :            : }
     745                 :            : 
     746                 :          0 : void SwTransferable::DeleteSelection()
     747                 :            : {
     748         [ #  # ]:          0 :     if(!pWrtShell)
     749                 :          0 :         return;
     750                 :            :     // ask for type of selection before action-bracketing
     751                 :          0 :     const int nSelection = pWrtShell->GetSelectionType();
     752                 :          0 :     pWrtShell->StartUndo( UNDO_DELETE );
     753         [ #  # ]:          0 :     if( ( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL ) & nSelection )
     754                 :          0 :         pWrtShell->IntelligentCut( nSelection );
     755                 :          0 :     pWrtShell->DelRight();
     756                 :          0 :     pWrtShell->EndUndo( UNDO_DELETE );
     757                 :            : }
     758                 :            : 
     759                 :          0 : int SwTransferable::PrepareForCopy( sal_Bool bIsCut )
     760                 :            : {
     761                 :          0 :     int nRet = 1;
     762         [ #  # ]:          0 :     if(!pWrtShell)
     763                 :          0 :         return 0;
     764                 :            : 
     765         [ #  # ]:          0 :     String sGrfNm;
     766         [ #  # ]:          0 :     const int nSelection = pWrtShell->GetSelectionType();
     767         [ #  # ]:          0 :     if( nSelection == nsSelectionType::SEL_GRF )
     768                 :            :     {
     769 [ #  # ][ #  # ]:          0 :         pClpGraphic = new Graphic;
     770 [ #  # ][ #  # ]:          0 :         if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic ))
     771                 :          0 :             pOrigGrf = pClpGraphic;
     772 [ #  # ][ #  # ]:          0 :         pClpBitmap = new Graphic;
     773 [ #  # ][ #  # ]:          0 :         if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap ))
     774                 :          0 :             pOrigGrf = pClpBitmap;
     775                 :            : 
     776 [ #  # ][ #  # ]:          0 :         pClpDocFac = new SwDocFac;
     777         [ #  # ]:          0 :         SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
     778         [ #  # ]:          0 :         pWrtShell->Copy( pDoc );
     779                 :            : 
     780 [ #  # ][ #  # ]:          0 :         if (pOrigGrf && !pOrigGrf->GetBitmap().IsEmpty())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
          #  #  #  #  #  
                      # ]
     781         [ #  # ]:          0 :           AddFormat( SOT_FORMATSTR_ID_SVXB );
     782                 :            : 
     783         [ #  # ]:          0 :         PrepareOLE( aObjDesc );
     784         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
     785                 :            : 
     786         [ #  # ]:          0 :         const Graphic* pGrf = pWrtShell->GetGraphic();
     787 [ #  # ][ #  # ]:          0 :         if( pGrf && pGrf->IsSupportedGraphic() )
         [ #  # ][ #  # ]
     788                 :            :         {
     789         [ #  # ]:          0 :             AddFormat( FORMAT_GDIMETAFILE );
     790         [ #  # ]:          0 :             AddFormat( FORMAT_BITMAP );
     791                 :            :         }
     792                 :          0 :         eBufferType = TRNSFR_GRAPHIC;
     793         [ #  # ]:          0 :         pWrtShell->GetGrfNms( &sGrfNm, 0 );
     794                 :            :     }
     795         [ #  # ]:          0 :     else if ( nSelection == nsSelectionType::SEL_OLE )
     796                 :            :     {
     797 [ #  # ][ #  # ]:          0 :         pClpDocFac = new SwDocFac;
     798         [ #  # ]:          0 :         SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
     799 [ #  # ][ #  # ]:          0 :         aDocShellRef = new SwDocShell( pDoc, SFX_CREATE_MODE_EMBEDDED);
                 [ #  # ]
     800         [ #  # ]:          0 :         aDocShellRef->DoInitNew( NULL );
     801         [ #  # ]:          0 :         pWrtShell->Copy( pDoc );
     802                 :            : 
     803         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
     804                 :            : 
     805                 :            :         // --> OD #i98753#
     806                 :            :         // set size of embedded object at the object description structure
     807 [ #  # ][ #  # ]:          0 :         aObjDesc.maSize = OutputDevice::LogicToLogic( pWrtShell->GetObjSize(), MAP_TWIP, MAP_100TH_MM );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     808                 :            :         // <--
     809         [ #  # ]:          0 :         PrepareOLE( aObjDesc );
     810         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
     811                 :            : 
     812         [ #  # ]:          0 :         AddFormat( FORMAT_GDIMETAFILE );
     813                 :          0 :         eBufferType = TRNSFR_OLE;
     814                 :            :     }
     815                 :            :     // Is there anything to provide anyway?
     816 [ #  # ][ #  # ]:          0 :     else if ( pWrtShell->IsSelection() || pWrtShell->IsFrmSelected() ||
         [ #  # ][ #  # ]
                 [ #  # ]
     817         [ #  # ]:          0 :               pWrtShell->IsObjSelected() )
     818                 :            :     {
     819                 :          0 :         SwWait *pWait = 0;
     820 [ #  # ][ #  # ]:          0 :         if( pWrtShell->ShouldWait() )
     821 [ #  # ][ #  # ]:          0 :             pWait = new SwWait( *pWrtShell->GetView().GetDocShell(), sal_True );
                 [ #  # ]
     822                 :            : 
     823 [ #  # ][ #  # ]:          0 :         pClpDocFac = new SwDocFac;
     824                 :            : 
     825                 :            :         // create additional cursor so that equal treatment of keyboard
     826                 :            :         // and mouse selection is possible.
     827                 :            :         // In AddMode with keyboard selection, the new cursor is not created
     828                 :            :         // before the cursor is moved after end of selection.
     829 [ #  # ][ #  # ]:          0 :         if( pWrtShell->IsAddMode() && pWrtShell->SwCrsrShell::HasSelection() )
         [ #  # ][ #  # ]
     830         [ #  # ]:          0 :             pWrtShell->CreateCrsr();
     831                 :            : 
     832         [ #  # ]:          0 :         SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac);
     833                 :            : 
     834         [ #  # ]:          0 :         pTmpDoc->LockExpFlds();     // nie die Felder updaten - Text so belassen
     835         [ #  # ]:          0 :         lclOverWriteDoc(*pWrtShell, *pTmpDoc);
     836                 :            : 
     837                 :            :         {
     838         [ #  # ]:          0 :             IDocumentMarkAccess* const pMarkAccess = pTmpDoc->getIDocumentMarkAccess();
     839         [ #  # ]:          0 :             ::std::vector< ::sw::mark::IMark* > vDdeMarks;
     840                 :            :             // find all DDE-Bookmarks
     841 [ #  # ][ #  # ]:          0 :             for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
         [ #  # ][ #  # ]
     842         [ #  # ]:          0 :                 ppMark != pMarkAccess->getMarksEnd();
     843                 :            :                 ppMark++)
     844                 :            :             {
     845 [ #  # ][ #  # ]:          0 :                 if(IDocumentMarkAccess::DDE_BOOKMARK == IDocumentMarkAccess::GetType(**ppMark))
     846         [ #  # ]:          0 :                     vDdeMarks.push_back(ppMark->get());
     847                 :            :             }
     848                 :            :             // remove all DDE-Bookmarks, they are invalid inside the clipdoc!
     849   [ #  #  #  # ]:          0 :             for(::std::vector< ::sw::mark::IMark* >::iterator ppMark = vDdeMarks.begin();
                 [ #  # ]
     850                 :          0 :                 ppMark != vDdeMarks.end();
     851                 :            :                 ++ppMark)
     852 [ #  # ][ #  # ]:          0 :                 pMarkAccess->deleteMark(*ppMark);
     853                 :            :         }
     854                 :            : 
     855                 :            :         // a new one was created in CORE (OLE-Objekte copied!)
     856 [ #  # ][ #  # ]:          0 :         aDocShellRef = pTmpDoc->GetTmpDocShell();
                 [ #  # ]
     857         [ #  # ]:          0 :         if( aDocShellRef.Is() )
     858         [ #  # ]:          0 :             SwTransferable::InitOle( aDocShellRef, *pTmpDoc );
     859 [ #  # ][ #  # ]:          0 :         pTmpDoc->SetTmpDocShell( (SfxObjectShell*)NULL );
                 [ #  # ]
     860                 :            : 
     861 [ #  # ][ #  # ]:          0 :         if( pWrtShell->IsObjSelected() )
     862                 :          0 :             eBufferType = TRNSFR_DRAWING;
     863                 :            :         else
     864                 :            :         {
     865                 :          0 :             eBufferType = TRNSFR_DOCUMENT;
     866 [ #  # ][ #  # ]:          0 :             if (pWrtShell->IntelligentCut(nSelection, sal_False) != SwWrtShell::NO_WORD)
     867                 :          0 :                 eBufferType = (TransferBufferType)(TRNSFR_DOCUMENT_WORD | eBufferType);
     868                 :            :         }
     869                 :            : 
     870                 :          0 :         int bDDELink = pWrtShell->IsSelection();
     871         [ #  # ]:          0 :         if( nSelection & nsSelectionType::SEL_TBL_CELLS )
     872                 :            :         {
     873                 :          0 :             eBufferType = (TransferBufferType)(TRNSFR_TABELLE | eBufferType);
     874         [ #  # ]:          0 :             bDDELink = pWrtShell->HasWholeTabSelection();
     875                 :            :         }
     876                 :            : 
     877                 :            :         //When someone needs it, we 'OLE' him something
     878         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
     879                 :            : 
     880                 :            :         //put RTF ahead of  the OLE's Metafile to have less loss
     881 [ #  # ][ #  # ]:          0 :         if( !pWrtShell->IsObjSelected() )
     882                 :            :         {
     883         [ #  # ]:          0 :             AddFormat( FORMAT_RTF );
     884         [ #  # ]:          0 :             AddFormat( SOT_FORMATSTR_ID_HTML );
     885                 :            :         }
     886         [ #  # ]:          0 :         if( pWrtShell->IsSelection() )
     887         [ #  # ]:          0 :             AddFormat( FORMAT_STRING );
     888                 :            : 
     889         [ #  # ]:          0 :         if( nSelection & ( nsSelectionType::SEL_DRW | nsSelectionType::SEL_DRW_FORM ))
     890                 :            :         {
     891         [ #  # ]:          0 :             AddFormat( SOT_FORMATSTR_ID_DRAWING );
     892         [ #  # ]:          0 :             if ( nSelection & nsSelectionType::SEL_DRW )
     893                 :            :             {
     894         [ #  # ]:          0 :                 AddFormat( FORMAT_GDIMETAFILE );
     895         [ #  # ]:          0 :                 AddFormat( FORMAT_BITMAP );
     896                 :            :             }
     897                 :          0 :             eBufferType = (TransferBufferType)( TRNSFR_GRAPHIC | eBufferType );
     898                 :            : 
     899 [ #  # ][ #  # ]:          0 :             pClpGraphic = new Graphic;
     900 [ #  # ][ #  # ]:          0 :             if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic ))
     901                 :          0 :                 pOrigGrf = pClpGraphic;
     902 [ #  # ][ #  # ]:          0 :             pClpBitmap = new Graphic;
     903 [ #  # ][ #  # ]:          0 :             if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap ))
     904                 :          0 :                 pOrigGrf = pClpBitmap;
     905                 :            : 
     906                 :            :             // is it an URL-Button ?
     907 [ #  # ][ #  # ]:          0 :             String sURL, sDesc;
     908 [ #  # ][ #  # ]:          0 :             if( pWrtShell->GetURLFromButton( sURL, sDesc ) )
     909                 :            :             {
     910         [ #  # ]:          0 :                 AddFormat( FORMAT_STRING );
     911         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_SOLK );
     912         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
     913         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_FILECONTENT );
     914         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR );
     915         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR );
     916                 :          0 :                 eBufferType = (TransferBufferType)( TRNSFR_INETFLD | eBufferType );
     917                 :          0 :                 nRet = sal_True;
     918 [ #  # ][ #  # ]:          0 :             }
     919                 :            :         }
     920                 :            : 
     921                 :            :         // at Cut, DDE-Link doesn't make sense!!
     922                 :            :         SwDocShell* pDShell;
     923 [ #  # ][ #  #  :          0 :         if( !bIsCut && bDDELink &&
             #  #  #  # ]
                 [ #  # ]
     924                 :          0 :             0 != ( pDShell = pWrtShell->GetDoc()->GetDocShell()) &&
     925                 :          0 :             SFX_CREATE_MODE_STANDARD == pDShell->GetCreateMode() )
     926                 :            :         {
     927         [ #  # ]:          0 :             AddFormat( SOT_FORMATSTR_ID_LINK );
     928 [ #  # ][ #  # ]:          0 :             refDdeLink = new SwTrnsfrDdeLink( *this, *pWrtShell );
                 [ #  # ]
     929                 :            :         }
     930                 :            : 
     931                 :            :         //ObjectDescriptor was already filly from the old DocShell.
     932                 :            :         //Now adjust it. Thus in GetData the first query can still
     933                 :            :         //be answered with delayed rendering.
     934                 :          0 :         aObjDesc.mbCanLink = sal_False;
     935                 :          0 :         Size aSz( OLESIZE );
     936 [ #  # ][ #  # ]:          0 :         aObjDesc.maSize = OutputDevice::LogicToLogic( aSz, MAP_TWIP, MAP_100TH_MM );
         [ #  # ][ #  # ]
                 [ #  # ]
     937                 :            : 
     938         [ #  # ]:          0 :         PrepareOLE( aObjDesc );
     939         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
     940                 :            : 
     941 [ #  # ][ #  # ]:          0 :         delete pWait;
     942                 :            :     }
     943                 :            :     else
     944                 :          0 :         nRet = 0;
     945                 :            : 
     946 [ #  # ][ #  # ]:          0 :     if( pWrtShell->IsFrmSelected() )
     947                 :            :     {
     948 [ #  # ][ #  # ]:          0 :         SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_URL, RES_URL );
     949         [ #  # ]:          0 :         pWrtShell->GetFlyFrmAttr( aSet );
     950         [ #  # ]:          0 :         const SwFmtURL& rURL = (SwFmtURL&)aSet.Get( RES_URL );
     951         [ #  # ]:          0 :         if( rURL.GetMap() )
     952                 :            :         {
     953 [ #  # ][ #  # ]:          0 :             pImageMap = new ImageMap( *rURL.GetMap() );
     954         [ #  # ]:          0 :             AddFormat( SOT_FORMATSTR_ID_SVIM );
     955                 :            :         }
     956         [ #  # ]:          0 :         else if( rURL.GetURL().Len() )
     957                 :            :         {
     958                 :            :             pTargetURL = new INetImage( sGrfNm, rURL.GetURL(),
     959                 :            :                                         rURL.GetTargetFrameName(),
     960 [ #  # ][ #  # ]:          0 :                                         aEmptyStr, Size() );
     961         [ #  # ]:          0 :             AddFormat( SOT_FORMATSTR_ID_INET_IMAGE );
     962         [ #  # ]:          0 :         }
     963                 :            :     }
     964                 :            : 
     965         [ #  # ]:          0 :     return nRet;
     966                 :            : }
     967                 :            : 
     968                 :          0 : int SwTransferable::Copy( sal_Bool bIsCut )
     969                 :            : {
     970                 :          0 :     int nRet = PrepareForCopy( bIsCut );
     971         [ #  # ]:          0 :     if ( nRet )
     972                 :            :     {
     973                 :          0 :         CopyToClipboard( &pWrtShell->GetView().GetEditWin() );
     974                 :            :     }
     975                 :          0 :     return nRet;
     976                 :            : }
     977                 :            : 
     978                 :          0 : int SwTransferable::CalculateAndCopy()
     979                 :            : {
     980         [ #  # ]:          0 :     if(!pWrtShell)
     981                 :          0 :         return 0;
     982 [ #  # ][ #  # ]:          0 :     SwWait aWait( *pWrtShell->GetView().GetDocShell(), sal_True );
     983                 :            : 
     984         [ #  # ]:          0 :     String aStr( pWrtShell->Calculate() );
     985                 :            : 
     986 [ #  # ][ #  # ]:          0 :     pClpDocFac = new SwDocFac;
     987         [ #  # ]:          0 :     SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
     988         [ #  # ]:          0 :     pWrtShell->Copy(pDoc, & aStr);
     989                 :          0 :     eBufferType = TRNSFR_DOCUMENT;
     990         [ #  # ]:          0 :     AddFormat( FORMAT_STRING );
     991                 :            : 
     992         [ #  # ]:          0 :     CopyToClipboard( &pWrtShell->GetView().GetEditWin() );
     993                 :            : 
     994 [ #  # ][ #  # ]:          0 :     return 1;
     995                 :            : }
     996                 :            : 
     997                 :          0 : int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary,
     998                 :            :                                     const String& rStr )
     999                 :            : {
    1000         [ #  # ]:          0 :     if(!pWrtShell)
    1001                 :          0 :         return 0;
    1002 [ #  # ][ #  # ]:          0 :     SwWait aWait( *pWrtShell->GetView().GetDocShell(), sal_True );
    1003                 :            : 
    1004 [ #  # ][ #  # ]:          0 :     pClpDocFac = new SwDocFac;
    1005         [ #  # ]:          0 :     SwDoc *const pCDoc = lcl_GetDoc(*pClpDocFac);
    1006                 :            : 
    1007         [ #  # ]:          0 :     SwNodes& rNds = pCDoc->GetNodes();
    1008         [ #  # ]:          0 :     SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() );
    1009         [ #  # ]:          0 :     SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // go to 1st ContentNode
    1010         [ #  # ]:          0 :     SwPaM aPam( *pCNd );
    1011                 :            : 
    1012         [ #  # ]:          0 :     pCDoc->LockExpFlds();   // never update fields - leave text as it is
    1013                 :            : 
    1014         [ #  # ]:          0 :     pCDoc->InsertGlossary( rGlossary, rStr, aPam, 0 );
    1015                 :            : 
    1016                 :            :     // a new one was created in CORE (OLE-Objects copied!)
    1017 [ #  # ][ #  # ]:          0 :     aDocShellRef = pCDoc->GetTmpDocShell();
                 [ #  # ]
    1018         [ #  # ]:          0 :     if( aDocShellRef.Is() )
    1019         [ #  # ]:          0 :         SwTransferable::InitOle( aDocShellRef, *pCDoc );
    1020 [ #  # ][ #  # ]:          0 :     pCDoc->SetTmpDocShell( (SfxObjectShell*)NULL );
                 [ #  # ]
    1021                 :            : 
    1022                 :          0 :     eBufferType = TRNSFR_DOCUMENT;
    1023                 :            : 
    1024                 :            :     //When someone needs it, we 'OLE' her something.
    1025         [ #  # ]:          0 :     AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
    1026         [ #  # ]:          0 :     AddFormat( FORMAT_RTF );
    1027         [ #  # ]:          0 :     AddFormat( SOT_FORMATSTR_ID_HTML );
    1028         [ #  # ]:          0 :     AddFormat( FORMAT_STRING );
    1029                 :            : 
    1030                 :            :     //ObjectDescriptor was already filled from the old DocShell.
    1031                 :            :     //Now adjust it. Thus in GetData the first query can still
    1032                 :            :     //be answered with delayed rendering.
    1033                 :          0 :     aObjDesc.mbCanLink = sal_False;
    1034                 :          0 :     Size aSz( OLESIZE );
    1035 [ #  # ][ #  # ]:          0 :     aObjDesc.maSize = OutputDevice::LogicToLogic( aSz, MAP_TWIP, MAP_100TH_MM );
         [ #  # ][ #  # ]
                 [ #  # ]
    1036                 :            : 
    1037         [ #  # ]:          0 :     PrepareOLE( aObjDesc );
    1038         [ #  # ]:          0 :     AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
    1039                 :            : 
    1040         [ #  # ]:          0 :     CopyToClipboard( &pWrtShell->GetView().GetEditWin() );
    1041                 :            : 
    1042 [ #  # ][ #  # ]:          0 :     return 1;
                 [ #  # ]
    1043                 :            : }
    1044                 :            : 
    1045                 :          0 : static inline uno::Reference < XTransferable > * lcl_getTransferPointer ( uno::Reference < XTransferable > &xRef )
    1046                 :            : {
    1047                 :          0 :     return &xRef;
    1048                 :            : }
    1049                 :            : 
    1050                 :          0 : sal_Bool SwTransferable::IsPaste( const SwWrtShell& rSh,
    1051                 :            :                               const TransferableDataHelper& rData )
    1052                 :            : {
    1053                 :            :     // Check the common case first: We can always paste our own data!
    1054                 :            :     // If _only_ the internal format can be pasted, this check will
    1055                 :            :     // yield 'true', while the one below would give a (wrong) result 'false'.
    1056                 :            : 
    1057                 :          0 :     bool bIsPaste = ( GetSwTransferable( rData ) != NULL );
    1058                 :            : 
    1059                 :            :     // if it's not our own data, we need to have a closer look:
    1060         [ #  # ]:          0 :     if( ! bIsPaste )
    1061                 :            :     {
    1062                 :            :         // determine the proper paste action, and return true if we find one
    1063         [ #  # ]:          0 :         uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() );
    1064                 :            : 
    1065         [ #  # ]:          0 :         sal_uInt16 nDestination = SwTransferable::GetSotDestination( rSh );
    1066                 :            :         sal_uInt16 nSourceOptions =
    1067                 :            :                     (( EXCHG_DEST_DOC_TEXTFRAME == nDestination ||
    1068                 :            :                        EXCHG_DEST_SWDOC_FREE_AREA == nDestination ||
    1069                 :            :                        EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination ||
    1070                 :            :                        EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination )
    1071                 :            :                                     ? EXCHG_IN_ACTION_COPY
    1072 [ #  # ][ #  # ]:          0 :                      : EXCHG_IN_ACTION_MOVE);
         [ #  # ][ #  # ]
    1073                 :            : 
    1074                 :            :         sal_uLong nFormat;          // output param for GetExchangeAction
    1075                 :            :         sal_uInt16 nEventAction;    // output param for GetExchangeAction
    1076                 :            :         sal_uInt16 nAction = SotExchange::GetExchangeAction(
    1077                 :          0 :                                 rData.GetDataFlavorExVector(),
    1078                 :            :                                 nDestination,
    1079                 :            :                                 nSourceOptions,             /* ?? */
    1080                 :            :                                 EXCHG_IN_ACTION_DEFAULT,    /* ?? */
    1081                 :            :                                 nFormat, nEventAction, 0,
    1082         [ #  # ]:          0 :                                 lcl_getTransferPointer ( xTransferable ) );
    1083                 :            : 
    1084                 :            :         // if we find a suitable action, we can paste!
    1085                 :          0 :         bIsPaste = (EXCHG_INOUT_ACTION_NONE != nAction);
    1086                 :            :     }
    1087                 :            : 
    1088                 :          0 :     return bIsPaste;
    1089                 :            : }
    1090                 :            : 
    1091                 :          0 : int SwTransferable::Paste( SwWrtShell& rSh, TransferableDataHelper& rData )
    1092                 :            : {
    1093                 :          0 :     sal_uInt16 nEventAction, nAction=0,
    1094         [ #  # ]:          0 :            nDestination = SwTransferable::GetSotDestination( rSh );
    1095                 :          0 :     sal_uLong nFormat = 0;
    1096                 :            : 
    1097 [ #  # ][ #  # ]:          0 :     if( GetSwTransferable( rData ) )
    1098                 :            :     {
    1099                 :          0 :         nAction = EXCHG_OUT_ACTION_INSERT_PRIVATE;
    1100                 :            :     }
    1101                 :            :     else
    1102                 :            :     {
    1103                 :            :         sal_uInt16 nSourceOptions =
    1104                 :            :                     (( EXCHG_DEST_DOC_TEXTFRAME == nDestination ||
    1105                 :            :                     EXCHG_DEST_SWDOC_FREE_AREA == nDestination ||
    1106                 :            :                     EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination ||
    1107                 :            :                     EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination )
    1108                 :            :                                     ? EXCHG_IN_ACTION_COPY
    1109 [ #  # ][ #  # ]:          0 :                                     : EXCHG_IN_ACTION_MOVE);
         [ #  # ][ #  # ]
    1110         [ #  # ]:          0 :         uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() );
    1111                 :            :         nAction = SotExchange::GetExchangeAction(
    1112                 :          0 :                                     rData.GetDataFlavorExVector(),
    1113                 :            :                                     nDestination,
    1114                 :            :                                     nSourceOptions,             /* ?? */
    1115                 :            :                                     EXCHG_IN_ACTION_DEFAULT,    /* ?? */
    1116                 :            :                                     nFormat, nEventAction, 0,
    1117         [ #  # ]:          0 :                                     lcl_getTransferPointer ( xTransferable ) );
    1118                 :            :     }
    1119                 :            : 
    1120                 :            :     // special case for tables from draw application
    1121         [ #  # ]:          0 :     if( EXCHG_OUT_ACTION_INSERT_DRAWOBJ == (nAction & EXCHG_ACTION_MASK) )
    1122                 :            :     {
    1123 [ #  # ][ #  # ]:          0 :         if( rData.HasFormat( SOT_FORMAT_RTF ) )
    1124                 :            :         {
    1125                 :          0 :             nAction = EXCHG_OUT_ACTION_INSERT_STRING | (nAction & !EXCHG_ACTION_MASK);
    1126                 :          0 :             nFormat = SOT_FORMAT_RTF;
    1127                 :            :         }
    1128                 :            :     }
    1129                 :            : 
    1130                 :            :     return EXCHG_INOUT_ACTION_NONE != nAction &&
    1131                 :            :             SwTransferable::PasteData( rData, rSh, nAction, nFormat,
    1132 [ #  # ][ #  # ]:          0 :                                         nDestination, sal_False, sal_False );
                 [ #  # ]
    1133                 :            : }
    1134                 :            : 
    1135                 :          0 : int SwTransferable::PasteData( TransferableDataHelper& rData,
    1136                 :            :                             SwWrtShell& rSh, sal_uInt16 nAction, sal_uLong nFormat,
    1137                 :            :                             sal_uInt16 nDestination, sal_Bool bIsPasteFmt,
    1138                 :            :                             sal_Bool bIsDefault,
    1139                 :            :                             const Point* pPt, sal_Int8 nDropAction,
    1140                 :            :                             sal_Bool bPasteSelection )
    1141                 :            : {
    1142                 :          0 :     SwWait aWait( *rSh.GetView().
    1143 [ #  # ][ #  # ]:          0 :         GetDocShell(), sal_False );
    1144                 :          0 :     SwTrnsfrActionAndUndo* pAction = 0;
    1145         [ #  # ]:          0 :     SwModule* pMod = SW_MOD();
    1146                 :            : 
    1147                 :          0 :     int nRet = 0;
    1148                 :          0 :     bool bCallAutoCaption = false;
    1149                 :            : 
    1150         [ #  # ]:          0 :     if( pPt )
    1151                 :            :     {
    1152                 :            :         // external Drop
    1153 [ #  # ][ #  # ]:          0 :         if( bPasteSelection ? !pMod->pXSelection : !pMod->pDragDrop )
    1154                 :            :         {
    1155         [ #  # ]:          0 :             switch( nDestination )
    1156                 :            :             {
    1157                 :            :             case EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP:
    1158                 :            :             case EXCHG_DEST_DOC_LNKD_GRAPHOBJ:
    1159                 :            :             case EXCHG_DEST_DOC_GRAPH_W_IMAP:
    1160                 :            :             case EXCHG_DEST_DOC_GRAPHOBJ:
    1161                 :            :             case EXCHG_DEST_DOC_OLEOBJ:
    1162                 :            :             case EXCHG_DEST_DOC_DRAWOBJ:
    1163                 :            :             case EXCHG_DEST_DOC_URLBUTTON:
    1164                 :            :             case EXCHG_DEST_DOC_GROUPOBJ:
    1165                 :            :                 // select frames/objects
    1166         [ #  # ]:          0 :                 SwTransferable::SetSelInShell( rSh, sal_True, pPt );
    1167                 :          0 :                 break;
    1168                 :            : 
    1169                 :            :             default:
    1170         [ #  # ]:          0 :                 SwTransferable::SetSelInShell( rSh, sal_False, pPt );
    1171                 :          0 :                 break;
    1172                 :            :             }
    1173                 :            :         }
    1174                 :            :     }
    1175 [ #  # ][ #  # ]:          0 :     else if( ( !GetSwTransferable( rData ) || bIsPasteFmt ) &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    1176         [ #  # ]:          0 :             !rSh.IsTableMode() && rSh.HasSelection() )
    1177                 :            :     {
    1178                 :            :         // then delete the selections
    1179                 :            : 
    1180                 :            :         //don't delete selected content
    1181                 :            :         // - at table-selection
    1182                 :            :         // - at ReRead of a graphic/DDEData
    1183                 :            :         // - at D&D, for the right selection was taken care of
    1184                 :            :         //      in Drop-Handler
    1185                 :          0 :         sal_Bool bDelSel = sal_False;
    1186         [ #  # ]:          0 :         switch( nDestination )
    1187                 :            :         {
    1188                 :            :         case EXCHG_DEST_DOC_TEXTFRAME:
    1189                 :            :         case EXCHG_DEST_SWDOC_FREE_AREA:
    1190                 :            :         case EXCHG_DEST_DOC_TEXTFRAME_WEB:
    1191                 :            :         case EXCHG_DEST_SWDOC_FREE_AREA_WEB:
    1192                 :          0 :             bDelSel = sal_True;
    1193                 :          0 :             break;
    1194                 :            :         }
    1195                 :            : 
    1196         [ #  # ]:          0 :         if( bDelSel )
    1197                 :            :             // #i34830#
    1198                 :            :             pAction = new SwTrnsfrActionAndUndo( &rSh, UNDO_PASTE_CLIPBOARD, NULL,
    1199 [ #  # ][ #  # ]:          0 :                                                  sal_True );
    1200                 :            :     }
    1201                 :            : 
    1202         [ #  # ]:          0 :     SwTransferable *pTrans=0, *pTunneledTrans=GetSwTransferable( rData );
    1203                 :            : 
    1204 [ #  # ][ #  # ]:          0 :     if( pPt && ( bPasteSelection ? 0 != ( pTrans = pMod->pXSelection )
         [ #  # ][ #  # ]
                 [ #  # ]
    1205                 :            :                                  : 0 != ( pTrans = pMod->pDragDrop) ))
    1206                 :            :     {
    1207                 :            :         // then internal Drag & Drop or XSelection
    1208                 :            :         nRet = pTrans->PrivateDrop( rSh, *pPt, DND_ACTION_MOVE == nDropAction,
    1209         [ #  # ]:          0 :                                     bPasteSelection );
    1210                 :            :     }
    1211 [ #  # ][ #  # ]:          0 :     else if( !pPt && pTunneledTrans &&
                 [ #  # ]
    1212                 :            :             EXCHG_OUT_ACTION_INSERT_PRIVATE == nAction )
    1213                 :            :     {
    1214                 :            :         // then internal paste
    1215         [ #  # ]:          0 :         nRet = pTunneledTrans->PrivatePaste( rSh );
    1216                 :            :     }
    1217         [ #  # ]:          0 :     else if( EXCHG_INOUT_ACTION_NONE != nAction )
    1218                 :            :     {
    1219         [ #  # ]:          0 :         if( !pAction )
    1220                 :            :         {
    1221 [ #  # ][ #  # ]:          0 :             pAction = new SwTrnsfrActionAndUndo( &rSh, UNDO_PASTE_CLIPBOARD);
    1222                 :            :         }
    1223                 :            : 
    1224                 :            :         // in Drag&Drop MessageBoxes must not be showed
    1225                 :          0 :         sal_Bool bMsg = 0 == pPt;
    1226                 :          0 :         sal_uInt8 nActionFlags = static_cast< sal_uInt8 >(( nAction >> 8 ) & 0xFF);
    1227                 :            : 
    1228                 :          0 :         sal_uInt16 nClearedAction = ( nAction & EXCHG_ACTION_MASK );
    1229                 :            :         // delete selections
    1230                 :            : 
    1231   [ #  #  #  #  :          0 :         switch( nClearedAction )
          #  #  #  #  #  
             #  #  #  #  
                      # ]
    1232                 :            :         {
    1233                 :            :         case EXCHG_OUT_ACTION_INSERT_PRIVATE:
    1234                 :            :             OSL_ENSURE( pPt, "EXCHG_OUT_ACTION_INSERT_PRIVATE: what should happen here?" );
    1235                 :          0 :             break;
    1236                 :            : 
    1237                 :            :         case EXCHG_OUT_ACTION_MOVE_PRIVATE:
    1238                 :            :             OSL_ENSURE( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: what should happen here?" );
    1239                 :          0 :             break;
    1240                 :            : 
    1241                 :            : 
    1242                 :            :         case EXCHG_IN_ACTION_MOVE:
    1243                 :            :         case EXCHG_IN_ACTION_COPY:
    1244                 :            :         case EXCHG_IN_ACTION_LINK:
    1245                 :            :         case EXCHG_OUT_ACTION_INSERT_HTML:
    1246                 :            :         case EXCHG_OUT_ACTION_INSERT_STRING:
    1247                 :            :         case EXCHG_OUT_ACTION_INSERT_IMAGEMAP:
    1248                 :            :         case EXCHG_OUT_ACTION_REPLACE_IMAGEMAP:
    1249                 :            : 
    1250                 :            :             // then we have to use the format
    1251   [ #  #  #  #  :          0 :             switch( nFormat )
          #  #  #  #  #  
                #  #  # ]
    1252                 :            :             {
    1253                 :            :             case SOT_FORMATSTR_ID_DRAWING:
    1254                 :            :                 nRet = SwTransferable::_PasteSdrFormat( rData, rSh,
    1255                 :            :                                                 SW_PASTESDR_INSERT, pPt,
    1256         [ #  # ]:          0 :                                                 nActionFlags );
    1257                 :          0 :                 break;
    1258                 :            : 
    1259                 :            :             case SOT_FORMATSTR_ID_HTML:
    1260                 :            :             case SOT_FORMATSTR_ID_HTML_SIMPLE:
    1261                 :            :             case SOT_FORMATSTR_ID_HTML_NO_COMMENT:
    1262                 :            :             case SOT_FORMAT_RTF:
    1263                 :            :             case SOT_FORMAT_STRING:
    1264                 :            :                 nRet = SwTransferable::_PasteFileContent( rData, rSh,
    1265         [ #  # ]:          0 :                                                             nFormat, bMsg );
    1266                 :          0 :                 break;
    1267                 :            : 
    1268                 :            :             case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
    1269                 :            :                 {
    1270         [ #  # ]:          0 :                     INetBookmark aBkmk;
    1271 [ #  # ][ #  # ]:          0 :                     if( rData.GetINetBookmark( nFormat, aBkmk ) )
    1272                 :            :                     {
    1273         [ #  # ]:          0 :                         SwFmtINetFmt aFmt( aBkmk.GetURL(), aEmptyStr );
    1274         [ #  # ]:          0 :                         rSh.InsertURL( aFmt, aBkmk.GetDescription() );
    1275         [ #  # ]:          0 :                         nRet = 1;
    1276         [ #  # ]:          0 :                     }
    1277                 :            :                 }
    1278                 :          0 :                 break;
    1279                 :            : 
    1280                 :            :             case SOT_FORMATSTR_ID_SD_OLE:
    1281                 :            :                 nRet = SwTransferable::_PasteOLE( rData, rSh, nFormat,
    1282         [ #  # ]:          0 :                                                     nActionFlags, bMsg );
    1283                 :          0 :                 break;
    1284                 :            : 
    1285                 :            :             case SOT_FORMATSTR_ID_SVIM:
    1286         [ #  # ]:          0 :                 nRet = SwTransferable::_PasteImageMap( rData, rSh );
    1287                 :          0 :                 break;
    1288                 :            : 
    1289                 :            :             case SOT_FORMATSTR_ID_SVXB:
    1290                 :            :             case SOT_FORMAT_BITMAP:
    1291                 :            :             case SOT_FORMAT_GDIMETAFILE:
    1292                 :            :                 nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat,
    1293                 :            :                                                 SW_PASTESDR_INSERT,pPt,
    1294         [ #  # ]:          0 :                                                 nActionFlags, bMsg );
    1295                 :          0 :                 break;
    1296                 :            : 
    1297                 :            :             case SOT_FORMATSTR_ID_XFORMS:
    1298                 :            :             case SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE:
    1299                 :            :             case SOT_FORMATSTR_ID_SBA_DATAEXCHANGE:
    1300                 :            :             case SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE:
    1301                 :            :                 nRet = SwTransferable::_PasteDBData( rData, rSh, nFormat,
    1302                 :            :                                             EXCHG_IN_ACTION_LINK == nClearedAction,
    1303         [ #  # ]:          0 :                                             pPt, bMsg );
    1304                 :          0 :                 break;
    1305                 :            : 
    1306                 :            :             case SOT_FORMAT_FILE:
    1307                 :            :                 nRet = SwTransferable::_PasteFileName( rData, rSh, nFormat,
    1308                 :            :                                 ( EXCHG_IN_ACTION_MOVE == nClearedAction
    1309                 :            :                                     ? SW_PASTESDR_REPLACE
    1310                 :            :                                     : EXCHG_IN_ACTION_LINK == nClearedAction
    1311                 :            :                                         ? SW_PASTESDR_SETATTR
    1312                 :            :                                         : SW_PASTESDR_INSERT),
    1313 [ #  # ][ #  # ]:          0 :                                 pPt, nActionFlags, bMsg );
                 [ #  # ]
    1314                 :          0 :                 break;
    1315                 :            : 
    1316                 :            :             case SOT_FORMAT_FILE_LIST:
    1317                 :            :                 // then insert as graphics only
    1318                 :            :                 nRet = SwTransferable::_PasteFileList( rData, rSh,
    1319                 :            :                                     EXCHG_IN_ACTION_LINK == nClearedAction,
    1320         [ #  # ]:          0 :                                     pPt, bMsg );
    1321                 :          0 :                 break;
    1322                 :            : 
    1323                 :            :             case SOT_FORMATSTR_ID_SONLK:
    1324         [ #  # ]:          0 :                 if( pPt )
    1325                 :            :                 {
    1326         [ #  # ]:          0 :                     NaviContentBookmark aBkmk;
    1327 [ #  # ][ #  # ]:          0 :                     if( aBkmk.Paste( rData ) )
    1328                 :            :                     {
    1329         [ #  # ]:          0 :                         if(bIsDefault)
    1330                 :            :                         {
    1331   [ #  #  #  # ]:          0 :                             switch(aBkmk.GetDefaultDragType())
    1332                 :            :                             {
    1333                 :          0 :                                 case REGION_MODE_NONE: nClearedAction = EXCHG_IN_ACTION_COPY; break;
    1334                 :          0 :                                 case REGION_MODE_EMBEDDED: nClearedAction = EXCHG_IN_ACTION_MOVE; break;
    1335                 :          0 :                                 case REGION_MODE_LINK: nClearedAction = EXCHG_IN_ACTION_LINK; break;
    1336                 :            :                             }
    1337                 :            :                         }
    1338         [ #  # ]:          0 :                         rSh.NavigatorPaste( aBkmk, nClearedAction );
    1339                 :          0 :                         nRet = 1;
    1340         [ #  # ]:          0 :                     }
    1341                 :            :                 }
    1342                 :          0 :                 break;
    1343                 :            : 
    1344                 :            :             case SOT_FORMATSTR_ID_INET_IMAGE:
    1345                 :            :             case SOT_FORMATSTR_ID_NETSCAPE_IMAGE:
    1346                 :            :                 nRet = SwTransferable::_PasteTargetURL( rData, rSh,
    1347                 :            :                                                         SW_PASTESDR_INSERT,
    1348         [ #  # ]:          0 :                                                         pPt, sal_True );
    1349                 :          0 :                 break;
    1350                 :            : 
    1351                 :            :             default:
    1352                 :            :                 OSL_ENSURE( pPt, "unknown format" );
    1353                 :            :             }
    1354                 :          0 :             break;
    1355                 :            : 
    1356                 :            :         case EXCHG_OUT_ACTION_INSERT_FILE:
    1357                 :            :             nRet = SwTransferable::_PasteFileName( rData, rSh, nFormat,
    1358                 :            :                                         SW_PASTESDR_INSERT, pPt,
    1359         [ #  # ]:          0 :                                         nActionFlags, bMsg );
    1360         [ #  # ]:          0 :             if( nRet & SWTRANSFER_GRAPHIC_INSERTED )
    1361                 :          0 :                 bCallAutoCaption = true;
    1362                 :          0 :             break;
    1363                 :            : 
    1364                 :            :         case EXCHG_OUT_ACTION_INSERT_OLE:
    1365                 :            :             nRet = SwTransferable::_PasteOLE( rData, rSh, nFormat,
    1366         [ #  # ]:          0 :                                                 nActionFlags,bMsg );
    1367                 :          0 :             break;
    1368                 :            : 
    1369                 :            :         case EXCHG_OUT_ACTION_INSERT_DDE:
    1370                 :            :             {
    1371         [ #  # ]:          0 :                 sal_Bool bReRead = 0 != CNT_HasGrf( rSh.GetCntType() );
    1372         [ #  # ]:          0 :                 nRet = SwTransferable::_PasteDDE( rData, rSh, bReRead, bMsg );
    1373                 :            :             }
    1374                 :          0 :             break;
    1375                 :            : 
    1376                 :            :         case EXCHG_OUT_ACTION_INSERT_HYPERLINK:
    1377                 :            :             {
    1378 [ #  # ][ #  # ]:          0 :                 String sURL, sDesc;
    1379         [ #  # ]:          0 :                 if( SOT_FORMAT_FILE == nFormat )
    1380                 :            :                 {
    1381 [ #  # ][ #  # ]:          0 :                     if( rData.GetString( nFormat, sURL ) && sURL.Len() )
         [ #  # ][ #  # ]
    1382                 :            :                     {
    1383         [ #  # ]:          0 :                         SwTransferable::_CheckForURLOrLNKFile( rData, sURL, &sDesc );
    1384         [ #  # ]:          0 :                         if( !sDesc.Len() )
    1385         [ #  # ]:          0 :                             sDesc = sURL;
    1386                 :          0 :                         nRet = 1;
    1387                 :            :                     }
    1388                 :            :                 }
    1389                 :            :                 else
    1390                 :            :                 {
    1391         [ #  # ]:          0 :                     INetBookmark aBkmk;
    1392 [ #  # ][ #  # ]:          0 :                     if( rData.GetINetBookmark( nFormat, aBkmk ) )
    1393                 :            :                     {
    1394         [ #  # ]:          0 :                         sURL = aBkmk.GetURL();
    1395         [ #  # ]:          0 :                         sDesc = aBkmk.GetDescription();
    1396                 :          0 :                         nRet = 1;
    1397         [ #  # ]:          0 :                     }
    1398                 :            :                 }
    1399                 :            : 
    1400         [ #  # ]:          0 :                 if( nRet )
    1401                 :            :                 {
    1402         [ #  # ]:          0 :                     SwFmtINetFmt aFmt( sURL, aEmptyStr );
    1403 [ #  # ][ #  # ]:          0 :                     rSh.InsertURL( aFmt, sDesc );
    1404 [ #  # ][ #  # ]:          0 :                 }
    1405                 :            :             }
    1406                 :          0 :             break;
    1407                 :            : 
    1408                 :            :         case EXCHG_OUT_ACTION_GET_ATTRIBUTES:
    1409      [ #  #  # ]:          0 :             switch( nFormat )
    1410                 :            :             {
    1411                 :            :             case SOT_FORMATSTR_ID_DRAWING:
    1412                 :            :                 nRet = SwTransferable::_PasteSdrFormat( rData, rSh,
    1413                 :            :                                                 SW_PASTESDR_SETATTR, pPt,
    1414         [ #  # ]:          0 :                                                 nActionFlags );
    1415                 :          0 :                 break;
    1416                 :            :             case SOT_FORMATSTR_ID_SVXB:
    1417                 :            :             case SOT_FORMAT_GDIMETAFILE:
    1418                 :            :             case SOT_FORMAT_BITMAP:
    1419                 :            :             case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
    1420                 :            :             case SOT_FORMAT_FILE:
    1421                 :            :             case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR:
    1422                 :            :             case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR:
    1423                 :            :                 nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat,
    1424                 :            :                                                 SW_PASTESDR_SETATTR, pPt,
    1425         [ #  # ]:          0 :                                                 nActionFlags, bMsg );
    1426                 :          0 :                 break;
    1427                 :            :             default:
    1428                 :            :                 OSL_FAIL( "unknown format" );
    1429                 :            :             }
    1430                 :            : 
    1431                 :          0 :             break;
    1432                 :            : 
    1433                 :            :         case EXCHG_OUT_ACTION_INSERT_DRAWOBJ:
    1434                 :            :             nRet = SwTransferable::_PasteSdrFormat( rData, rSh,
    1435                 :            :                                                 SW_PASTESDR_INSERT, pPt,
    1436         [ #  # ]:          0 :                                                 nActionFlags );
    1437                 :          0 :             break;
    1438                 :            :         case EXCHG_OUT_ACTION_INSERT_SVXB:
    1439                 :            :         case EXCHG_OUT_ACTION_INSERT_GDIMETAFILE:
    1440                 :            :         case EXCHG_OUT_ACTION_INSERT_BITMAP:
    1441                 :            :         case EXCHG_OUT_ACTION_INSERT_GRAPH:
    1442                 :            :             nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat,
    1443                 :            :                                                 SW_PASTESDR_INSERT, pPt,
    1444         [ #  # ]:          0 :                                                 nActionFlags, bMsg );
    1445                 :          0 :             break;
    1446                 :            : 
    1447                 :            :         case EXCHG_OUT_ACTION_REPLACE_DRAWOBJ:
    1448                 :            :             nRet = SwTransferable::_PasteSdrFormat( rData, rSh,
    1449                 :            :                                                 SW_PASTESDR_REPLACE, pPt,
    1450         [ #  # ]:          0 :                                                 nActionFlags );
    1451                 :          0 :             break;
    1452                 :            : 
    1453                 :            :         case EXCHG_OUT_ACTION_REPLACE_SVXB:
    1454                 :            :         case EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE:
    1455                 :            :         case EXCHG_OUT_ACTION_REPLACE_BITMAP:
    1456                 :            :         case EXCHG_OUT_ACTION_REPLACE_GRAPH:
    1457                 :            :             nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat,
    1458                 :            :                                                 SW_PASTESDR_REPLACE,pPt,
    1459         [ #  # ]:          0 :                                                 nActionFlags, bMsg );
    1460                 :          0 :             break;
    1461                 :            : 
    1462                 :            :         case EXCHG_OUT_ACTION_INSERT_INTERACTIVE:
    1463         [ #  # ]:          0 :             nRet = SwTransferable::_PasteAsHyperlink( rData, rSh, nFormat );
    1464                 :          0 :             break;
    1465                 :            : 
    1466                 :            :         default:
    1467                 :            :             OSL_FAIL("unknown action" );
    1468                 :            :         }
    1469                 :            :     }
    1470                 :            : 
    1471 [ #  # ][ #  # ]:          0 :     if( !bPasteSelection && rSh.IsFrmSelected() )
         [ #  # ][ #  # ]
    1472                 :            :     {
    1473         [ #  # ]:          0 :         rSh.EnterSelFrmMode();
    1474                 :            :         //force ::SelectShell
    1475         [ #  # ]:          0 :         rSh.GetView().StopShellTimer();
    1476                 :            :     }
    1477                 :            : 
    1478 [ #  # ][ #  # ]:          0 :     delete pAction;
    1479         [ #  # ]:          0 :     if( bCallAutoCaption )
    1480         [ #  # ]:          0 :         rSh.GetView().AutoCaption( GRAPHIC_CAP );
    1481                 :            : 
    1482         [ #  # ]:          0 :     return nRet;
    1483                 :            : }
    1484                 :            : 
    1485                 :       5622 : sal_uInt16 SwTransferable::GetSotDestination( const SwWrtShell& rSh,
    1486                 :            :                                             const Point* pPt )
    1487                 :            : {
    1488                 :       5622 :     sal_uInt16 nRet = EXCHG_INOUT_ACTION_NONE;
    1489                 :            : 
    1490                 :            :     ObjCntType eOType;
    1491         [ -  + ]:       5622 :     if( pPt )
    1492                 :            :     {
    1493                 :          0 :         SdrObject *pObj = 0;
    1494         [ #  # ]:          0 :         eOType = rSh.GetObjCntType( *pPt, pObj );
    1495                 :            :     }
    1496                 :            :     else
    1497                 :       5622 :         eOType = rSh.GetObjCntTypeOfSelection();
    1498                 :            : 
    1499   [ -  -  -  -  :       5622 :     switch( eOType )
                -  -  + ]
    1500                 :            :     {
    1501                 :            :     case OBJCNT_GRF:
    1502                 :            :         {
    1503                 :            :             sal_Bool bIMap, bLink;
    1504         [ #  # ]:          0 :             if( pPt )
    1505                 :            :             {
    1506 [ #  # ][ #  # ]:          0 :                 bIMap = 0 != rSh.GetFmtFromObj( *pPt )->GetURL().GetMap();
    1507         [ #  # ]:          0 :                 String aDummy;
    1508 [ #  # ][ #  # ]:          0 :                 rSh.GetGrfAtPos( *pPt, aDummy, bLink );
    1509                 :            :             }
    1510                 :            :             else
    1511                 :            :             {
    1512 [ #  # ][ #  # ]:          0 :                 bIMap = 0 != rSh.GetFlyFrmFmt()->GetURL().GetMap();
    1513         [ #  # ]:          0 :                 String aDummy;
    1514         [ #  # ]:          0 :                 rSh.GetGrfNms( &aDummy, 0 );
    1515         [ #  # ]:          0 :                 bLink = 0 != aDummy.Len();
    1516                 :            :             }
    1517                 :            : 
    1518 [ #  # ][ #  # ]:          0 :             if( bLink && bIMap )
    1519                 :          0 :                 nRet = EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP;
    1520         [ #  # ]:          0 :             else if( bLink )
    1521                 :          0 :                 nRet = EXCHG_DEST_DOC_LNKD_GRAPHOBJ;
    1522         [ #  # ]:          0 :             else if( bIMap )
    1523                 :          0 :                 nRet = EXCHG_DEST_DOC_GRAPH_W_IMAP;
    1524                 :            :             else
    1525                 :          0 :                 nRet = EXCHG_DEST_DOC_GRAPHOBJ;
    1526                 :            :         }
    1527                 :          0 :         break;
    1528                 :            : 
    1529                 :            :     case OBJCNT_FLY:
    1530         [ #  # ]:          0 :         if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
    1531                 :          0 :             nRet = EXCHG_DEST_DOC_TEXTFRAME_WEB;
    1532                 :            :         else
    1533                 :          0 :             nRet = EXCHG_DEST_DOC_TEXTFRAME;
    1534                 :          0 :         break;
    1535                 :          0 :     case OBJCNT_OLE:        nRet = EXCHG_DEST_DOC_OLEOBJ;       break;
    1536                 :            : 
    1537                 :            :     case OBJCNT_CONTROL:    /* no Action avail */
    1538                 :          0 :     case OBJCNT_SIMPLE:     nRet = EXCHG_DEST_DOC_DRAWOBJ;      break;
    1539                 :          0 :     case OBJCNT_URLBUTTON:  nRet = EXCHG_DEST_DOC_URLBUTTON;    break;
    1540                 :          0 :     case OBJCNT_GROUPOBJ:   nRet = EXCHG_DEST_DOC_GROUPOBJ;     break;
    1541                 :            : 
    1542                 :            : // what do we do at multiple selections???
    1543                 :            :     default:
    1544                 :            :         {
    1545         [ +  + ]:       5622 :             if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
    1546                 :         12 :                 nRet = EXCHG_DEST_SWDOC_FREE_AREA_WEB;
    1547                 :            :             else
    1548                 :       5610 :                 nRet = EXCHG_DEST_SWDOC_FREE_AREA;
    1549                 :            :         }
    1550                 :            :     }
    1551                 :            : 
    1552                 :       5622 :     return nRet;
    1553                 :            : }
    1554                 :            : 
    1555                 :          0 : int SwTransferable::_PasteFileContent( TransferableDataHelper& rData,
    1556                 :            :                                     SwWrtShell& rSh, sal_uLong nFmt, sal_Bool bMsg )
    1557                 :            : {
    1558                 :          0 :     sal_uInt16 nResId = MSG_CLPBRD_FORMAT_ERROR;
    1559                 :          0 :     int nRet = 0;
    1560                 :            : 
    1561         [ #  # ]:          0 :     MSE40HTMLClipFormatObj aMSE40ClpObj;
    1562                 :            : 
    1563                 :          0 :     SotStorageStreamRef xStrm;
    1564                 :          0 :     SvStream* pStream = 0;
    1565                 :          0 :     SwRead pRead = 0;
    1566                 :          0 :     rtl::OUString sData;
    1567         [ #  # ]:          0 :     switch( nFmt )
    1568                 :            :     {
    1569                 :            :     case SOT_FORMAT_STRING:
    1570                 :            :         {
    1571                 :          0 :             pRead = ReadAscii;
    1572 [ #  # ][ #  # ]:          0 :             if( rData.GetString( nFmt, sData ) )
    1573                 :            :             {
    1574                 :            :                 pStream = new SvMemoryStream( (void*)sData.getStr(),
    1575                 :          0 :                             sData.getLength() * sizeof( sal_Unicode ),
    1576 [ #  # ][ #  # ]:          0 :                             STREAM_READ );
    1577                 :            : #ifdef OSL_BIGENDIAN
    1578                 :            :                 pStream->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
    1579                 :            : #else
    1580         [ #  # ]:          0 :                 pStream->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
    1581                 :            : #endif
    1582                 :            : 
    1583         [ #  # ]:          0 :                 SwAsciiOptions aAOpt;
    1584                 :          0 :                 aAOpt.SetCharSet( RTL_TEXTENCODING_UCS2 );
    1585         [ #  # ]:          0 :                 pRead->GetReaderOpt().SetASCIIOpts( aAOpt );
    1586         [ #  # ]:          0 :                 break;
    1587                 :            :             }
    1588                 :            :         }
    1589                 :            :         // no break - because then test if we get a stream
    1590                 :            : 
    1591                 :            :     default:
    1592 [ #  # ][ #  # ]:          0 :         if( rData.GetSotStorageStream( nFmt, xStrm ) )
    1593                 :            :         {
    1594 [ #  # ][ #  # ]:          0 :             if( ( SOT_FORMATSTR_ID_HTML_SIMPLE == nFmt ) ||
    1595                 :            :                 ( SOT_FORMATSTR_ID_HTML_NO_COMMENT == nFmt ) )
    1596                 :            :             {
    1597         [ #  # ]:          0 :                 pStream = aMSE40ClpObj.IsValid( *xStrm );
    1598                 :          0 :                 pRead = ReadHTML;
    1599                 :          0 :                 pRead->SetReadUTF8( sal_True );
    1600                 :            : 
    1601                 :            :                 sal_Bool bNoComments =
    1602                 :          0 :                     ( nFmt == SOT_FORMATSTR_ID_HTML_NO_COMMENT );
    1603                 :          0 :                 pRead->SetIgnoreHTMLComments( bNoComments );
    1604                 :            :             }
    1605                 :            :             else
    1606                 :            :             {
    1607                 :          0 :                 pStream = &xStrm;
    1608         [ #  # ]:          0 :                 if( SOT_FORMAT_RTF == nFmt )
    1609         [ #  # ]:          0 :                     pRead = SwReaderWriter::GetReader( READER_WRITER_RTF );
    1610         [ #  # ]:          0 :                 else if( !pRead )
    1611                 :            :                 {
    1612                 :          0 :                     pRead = ReadHTML;
    1613                 :          0 :                     pRead->SetReadUTF8( sal_True );
    1614                 :            :                 }
    1615                 :            :             }
    1616                 :            :         }
    1617                 :          0 :         break;
    1618                 :            :     }
    1619                 :            : 
    1620 [ #  # ][ #  # ]:          0 :     if( pStream && pRead )
    1621                 :            :     {
    1622                 :          0 :         Link aOldLink( rSh.GetChgLnk() );
    1623         [ #  # ]:          0 :         rSh.SetChgLnk( Link() );
    1624                 :            : 
    1625 [ #  # ][ #  # ]:          0 :         const SwPosition& rInsPos = *rSh.GetCrsr()->Start();
    1626 [ #  # ][ #  # ]:          0 :         SwReader aReader( *pStream, aEmptyStr, String(), *rSh.GetCrsr() );
         [ #  # ][ #  # ]
    1627         [ #  # ]:          0 :         rSh.SaveTblBoxCntnt( &rInsPos );
    1628 [ #  # ][ #  # ]:          0 :         if( IsError( aReader.Read( *pRead )) )
    1629                 :          0 :             nResId = ERR_CLPBRD_READ;
    1630                 :            :         else
    1631                 :          0 :             nResId = 0, nRet = 1;
    1632                 :            : 
    1633                 :          0 :         rSh.SetChgLnk( aOldLink );
    1634         [ #  # ]:          0 :         if( nRet )
    1635 [ #  # ][ #  # ]:          0 :             rSh.CallChgLnk();
    1636                 :            :     }
    1637                 :            :     else
    1638                 :          0 :         nResId = MSG_CLPBRD_FORMAT_ERROR;
    1639                 :            : 
    1640                 :            :     // Exist a SvMemoryStream? (data in the OUString and xStrm is empty)
    1641 [ #  # ][ #  # ]:          0 :     if( pStream && !xStrm.Is() )
                 [ #  # ]
    1642 [ #  # ][ #  # ]:          0 :         delete pStream;
    1643                 :            : 
    1644 [ #  # ][ #  # ]:          0 :     if( bMsg && nResId )
    1645                 :            :     {
    1646 [ #  # ][ #  # ]:          0 :         InfoBox( 0, SW_RES( nResId )).Execute();
                 [ #  # ]
    1647                 :            :     }
    1648 [ #  # ][ #  # ]:          0 :     return nRet;
    1649                 :            : }
    1650                 :            : 
    1651                 :          0 : int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh,
    1652                 :            :                                 sal_uLong nFmt, sal_uInt8 nActionFlags, sal_Bool bMsg )
    1653                 :            : {
    1654                 :          0 :     int nRet = 0;
    1655         [ #  # ]:          0 :     TransferableObjectDescriptor aObjDesc;
    1656                 :          0 :     uno::Reference < io::XInputStream > xStrm;
    1657                 :          0 :     uno::Reference < embed::XStorage > xStore;
    1658                 :          0 :     Reader* pRead = 0;
    1659                 :            : 
    1660                 :            :     // Get the preferred format
    1661                 :            :     SotFormatStringId nId;
    1662 [ #  # ][ #  # ]:          0 :     if( rData.HasFormat( SOT_FORMATSTR_ID_EMBEDDED_OBJ ) )
    1663                 :          0 :         nId = SOT_FORMATSTR_ID_EMBEDDED_OBJ;
    1664 [ #  # ][ #  # ]:          0 :     else if( rData.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ) &&
         [ #  # ][ #  # ]
    1665         [ #  # ]:          0 :              rData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ))
    1666                 :          0 :         nId = SOT_FORMATSTR_ID_EMBED_SOURCE;
    1667                 :            :     else
    1668                 :          0 :         nId = 0;
    1669                 :            : 
    1670 [ #  # ][ #  # ]:          0 :     if( nId && rData.GetInputStream( nId, xStrm ) && xStrm.is() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1671                 :            :     {
    1672                 :            :         // if there is an embedded object, first try if it's a writer object
    1673                 :            :         // this will be inserted into the document by using a Reader
    1674                 :            :         try
    1675                 :            :         {
    1676 [ #  # ][ #  # ]:          0 :             xStore = comphelper::OStorageHelper::GetStorageFromInputStream( xStrm );
    1677 [ #  # ][ #  # ]:          0 :             switch( SotStorage::GetFormatID( xStore ) )
    1678                 :            :             {
    1679                 :            :                 case SOT_FORMATSTR_ID_STARWRITER_60:
    1680                 :            :                 case SOT_FORMATSTR_ID_STARWRITERWEB_60:
    1681                 :            :                 case SOT_FORMATSTR_ID_STARWRITERGLOB_60:
    1682                 :            :                 case SOT_FORMATSTR_ID_STARWRITER_8:
    1683                 :            :                 case SOT_FORMATSTR_ID_STARWRITERWEB_8:
    1684                 :            :                 case SOT_FORMATSTR_ID_STARWRITERGLOB_8:
    1685                 :          0 :                     pRead = ReadXML;
    1686                 :          0 :                     break;
    1687                 :            :                 default:
    1688                 :            :                     try
    1689                 :            :                     {
    1690         [ #  # ]:          0 :                         uno::Reference < lang::XComponent > xComp( xStore, uno::UNO_QUERY );
    1691 [ #  # ][ #  # ]:          0 :                         xComp->dispose();
    1692 [ #  # ][ #  # ]:          0 :                         xStore = 0;
    1693                 :            :                     }
    1694   [ #  #  #  # ]:          0 :                     catch (const uno::Exception&)
    1695                 :            :                     {
    1696                 :            :                     }
    1697                 :            : 
    1698                 :          0 :                     break;
    1699                 :            :             }
    1700                 :            :         }
    1701         [ #  # ]:          0 :         catch (const uno::Exception&)
    1702                 :            :         {
    1703                 :            :             // it wasn't a storage, but maybe it's a useful stream
    1704                 :            :         }
    1705                 :            : 
    1706                 :          0 :         nFmt = nId;
    1707                 :            :     }
    1708                 :            : 
    1709         [ #  # ]:          0 :     if( pRead )
    1710                 :            :     {
    1711         [ #  # ]:          0 :         SwPaM &rPAM = *rSh.GetCrsr();
    1712         [ #  # ]:          0 :         SwReader aReader( xStore, aEmptyStr, rPAM );
    1713 [ #  # ][ #  # ]:          0 :         if( !IsError( aReader.Read( *pRead )) )
    1714                 :          0 :             nRet = 1;
    1715         [ #  # ]:          0 :         else if( bMsg )
    1716 [ #  # ][ #  # ]:          0 :             InfoBox( 0, SW_RES(ERR_CLPBRD_READ) ).Execute();
         [ #  # ][ #  # ]
    1717                 :            :     }
    1718                 :            :     else
    1719                 :            :     {
    1720                 :            :            // temporary storage until the object is inserted
    1721                 :          0 :         uno::Reference< embed::XStorage > xTmpStor;
    1722                 :          0 :         uno::Reference < embed::XEmbeddedObject > xObj;
    1723                 :          0 :         ::rtl::OUString aName;
    1724         [ #  # ]:          0 :            comphelper::EmbeddedObjectContainer aCnt;
    1725                 :            : 
    1726         [ #  # ]:          0 :         if ( xStrm.is() )
    1727                 :            :         {
    1728         [ #  # ]:          0 :             if ( !rData.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) )
    1729                 :            :             {
    1730                 :            :                 OSL_ENSURE( !xStrm.is(), "An object without descriptor in clipboard!");
    1731                 :            :             }
    1732                 :            :         }
    1733                 :            :         else
    1734                 :            :         {
    1735 [ #  # ][ #  # ]:          0 :             if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ) && rData.GetTransferableObjectDescriptor( nFmt, aObjDesc ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1736                 :            :              {
    1737 [ #  # ][ #  # ]:          0 :                 if ( !rData.GetInputStream( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStrm ) )
    1738         [ #  # ]:          0 :                     rData.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStrm );
    1739                 :            : 
    1740         [ #  # ]:          0 :                 if ( !xStrm.is() )
    1741                 :            :                 {
    1742                 :            :                     // This is MSOLE object that should be created by direct using of system clipboard
    1743                 :            :                     try
    1744                 :            :                     {
    1745 [ #  # ][ #  # ]:          0 :                         xTmpStor = ::comphelper::OStorageHelper::GetTemporaryStorage();
    1746                 :            :                         uno::Reference < embed::XEmbedObjectClipboardCreator > xClipboardCreator(
    1747 [ #  # ][ #  # ]:          0 :                             ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(
    1748                 :          0 :                                             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.MSOLEObjectSystemCreator")) ),
    1749 [ #  # ][ #  # ]:          0 :                             uno::UNO_QUERY_THROW );
                 [ #  # ]
    1750                 :            : 
    1751         [ #  # ]:          0 :                         embed::InsertedObjectInfo aInfo = xClipboardCreator->createInstanceInitFromClipboard(
    1752                 :            :                                                             xTmpStor,
    1753                 :            :                                                             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "DummyName" ) ),
    1754 [ #  # ][ #  # ]:          0 :                                                             uno::Sequence< beans::PropertyValue >() );
         [ #  # ][ #  # ]
    1755                 :            : 
    1756                 :            :                         // TODO/LATER: in future InsertedObjectInfo will be used to get container related information
    1757                 :            :                         // for example whether the object should be an iconified one
    1758 [ #  # ][ #  # ]:          0 :                         xObj = aInfo.Object;
                 [ #  # ]
    1759                 :            :                     }
    1760         [ #  # ]:          0 :                     catch (const uno::Exception&)
    1761                 :            :                     {
    1762                 :            :                     }
    1763                 :            :                 }
    1764                 :            :             }
    1765                 :            :         }
    1766                 :            : 
    1767 [ #  # ][ #  # ]:          0 :         if ( xStrm.is() && !xObj.is() )
                 [ #  # ]
    1768 [ #  # ][ #  # ]:          0 :             xObj = aCnt.InsertEmbeddedObject( xStrm, aName );
    1769                 :            : 
    1770         [ #  # ]:          0 :         if( xObj.is() )
    1771                 :            :         {
    1772         [ #  # ]:          0 :             svt::EmbeddedObjectRef xObjRef( xObj, aObjDesc.mnViewAspect );
    1773                 :            : 
    1774                 :            :             // try to get the replacement image from the clipboard
    1775         [ #  # ]:          0 :             Graphic aGraphic;
    1776                 :          0 :             sal_uLong nGrFormat = 0;
    1777                 :            : 
    1778                 :            :             // insert replacement image ( if there is one ) into the object helper
    1779         [ #  # ]:          0 :             if ( nGrFormat )
    1780                 :            :             {
    1781                 :          0 :                 datatransfer::DataFlavor aDataFlavor;
    1782         [ #  # ]:          0 :                 SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
    1783         [ #  # ]:          0 :                    xObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
    1784                 :            :             }
    1785         [ #  # ]:          0 :             else if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
    1786                 :            :             {
    1787                 :            :                 // it is important to have an icon, let an empty graphic be used
    1788                 :            :                 // if no other graphic is provided
    1789                 :            :                 // TODO/LATER: in future a default bitmap could be used
    1790                 :          0 :                 ::rtl::OUString aMimeType;
    1791         [ #  # ]:          0 :                 MapMode aMapMode( MAP_100TH_MM );
    1792         [ #  # ]:          0 :                 aGraphic.SetPrefSize( Size( 2500, 2500 ) );
    1793         [ #  # ]:          0 :                 aGraphic.SetPrefMapMode( aMapMode );
    1794 [ #  # ][ #  # ]:          0 :                    xObjRef.SetGraphic( aGraphic, aMimeType );
    1795                 :            :             }
    1796                 :            : 
    1797                 :            :             //set size. This is a hack because of handing over, size should be
    1798                 :            :             //passed to the InsertOle!!!!!!!!!!
    1799                 :          0 :             Size aSize;
    1800         [ #  # ]:          0 :             if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
    1801                 :            :             {
    1802 [ #  # ][ #  # ]:          0 :                    if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
                 [ #  # ]
    1803                 :          0 :                     aSize = aObjDesc.maSize;
    1804                 :            :                 else
    1805                 :            :                 {
    1806         [ #  # ]:          0 :                     MapMode aMapMode( MAP_100TH_MM );
    1807 [ #  # ][ #  # ]:          0 :                     aSize = xObjRef.GetSize( &aMapMode );
    1808                 :            :                 }
    1809                 :            :             }
    1810 [ #  # ][ #  # ]:          0 :             else if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
                 [ #  # ]
    1811                 :            :             {
    1812                 :          0 :                 aSize = Size( aObjDesc.maSize );    //always 100TH_MM
    1813 [ #  # ][ #  # ]:          0 :                 MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
                 [ #  # ]
    1814 [ #  # ][ #  # ]:          0 :                 aSize = OutputDevice::LogicToLogic( aSize, MAP_100TH_MM, aUnit );
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1815                 :          0 :                 awt::Size aSz;
    1816                 :            :                 try
    1817                 :            :                 {
    1818 [ #  # ][ #  # ]:          0 :                     aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
    1819                 :            :                 }
    1820   [ #  #  #  # ]:          0 :                 catch (const embed::NoVisualAreaSizeException&)
    1821                 :            :                 {
    1822                 :            :                     // in this case the provided size is used
    1823                 :            :                 }
    1824                 :            : 
    1825 [ #  # ][ #  # ]:          0 :                 if ( aSz.Width != aSize.Width() || aSz.Height != aSize.Height() )
                 [ #  # ]
    1826                 :            :                 {
    1827                 :          0 :                     aSz.Width = aSize.Width();
    1828                 :          0 :                     aSz.Height = aSize.Height();
    1829 [ #  # ][ #  # ]:          0 :                     xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
    1830                 :            :                 }
    1831                 :            :             }
    1832                 :            :             else
    1833                 :            :             {
    1834                 :            :                 // the descriptor contains the wrong object size
    1835                 :            :                 // the following call will let the MSOLE objects cache the size if it is possible
    1836                 :            :                 // it should be done while the object is running
    1837                 :            :                 try
    1838                 :            :                 {
    1839 [ #  # ][ #  # ]:          0 :                     xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
    1840                 :            :                 }
    1841         [ #  # ]:          0 :                 catch (const uno::Exception&)
    1842                 :            :                 {
    1843                 :            :                 }
    1844                 :            :             }
    1845                 :            :             //End of Hack!
    1846                 :            : 
    1847         [ #  # ]:          0 :             rSh.InsertOleObject( xObjRef );
    1848                 :          0 :             nRet = 1;
    1849                 :            : 
    1850 [ #  # ][ #  # ]:          0 :             if( nRet && ( nActionFlags &
    1851                 :            :                 ( EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL >> 8) ))
    1852         [ #  # ]:          0 :                 SwTransferable::_PasteTargetURL( rData, rSh, 0, 0, sal_False );
    1853                 :            : 
    1854                 :            :             // let the object be unloaded if possible
    1855 [ #  # ][ #  # ]:          0 :             SwOLEObj::UnloadObject( xObj, rSh.GetDoc(), embed::Aspects::MSOLE_CONTENT );
                 [ #  # ]
    1856         [ #  # ]:          0 :         }
    1857                 :            :     }
    1858         [ #  # ]:          0 :     return nRet;
    1859                 :            : }
    1860                 :            : 
    1861                 :          0 : int SwTransferable::_PasteTargetURL( TransferableDataHelper& rData,
    1862                 :            :                                     SwWrtShell& rSh, sal_uInt16 nAction,
    1863                 :            :                                     const Point* pPt, sal_Bool bInsertGRF )
    1864                 :            : {
    1865                 :          0 :     int nRet = 0;
    1866         [ #  # ]:          0 :     INetImage aINetImg;
    1867 [ #  # ][ #  # ]:          0 :     if( ( rData.HasFormat( SOT_FORMATSTR_ID_INET_IMAGE ) &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1868         [ #  # ]:          0 :           rData.GetINetImage( SOT_FORMATSTR_ID_INET_IMAGE, aINetImg )) ||
    1869         [ #  # ]:          0 :         ( rData.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_IMAGE ) &&
    1870         [ #  # ]:          0 :           rData.GetINetImage( SOT_FORMATSTR_ID_NETSCAPE_IMAGE, aINetImg )) )
    1871                 :            :     {
    1872 [ #  # ][ #  # ]:          0 :         if( aINetImg.GetImageURL().Len() && bInsertGRF )
                 [ #  # ]
    1873                 :            :         {
    1874         [ #  # ]:          0 :             String sURL( aINetImg.GetImageURL() );
    1875         [ #  # ]:          0 :             SwTransferable::_CheckForURLOrLNKFile( rData, sURL );
    1876                 :            : 
    1877                 :            :             //!!! check at FileSystem - only then it make sense to test graphics !!!
    1878         [ #  # ]:          0 :             Graphic aGrf;
    1879         [ #  # ]:          0 :             GraphicFilter &rFlt = GraphicFilter::GetGraphicFilter();
    1880         [ #  # ]:          0 :             nRet = GRFILTER_OK == GraphicFilter::LoadGraphic( sURL, aEmptyStr, aGrf, &rFlt );
    1881         [ #  # ]:          0 :             if( nRet )
    1882                 :            :             {
    1883   [ #  #  #  # ]:          0 :                 switch( nAction )
    1884                 :            :                 {
    1885                 :            :                 case SW_PASTESDR_INSERT:
    1886         [ #  # ]:          0 :                     SwTransferable::SetSelInShell( rSh, sal_False, pPt );
    1887         [ #  # ]:          0 :                     rSh.Insert( sURL, aEmptyStr, aGrf );
    1888                 :          0 :                     break;
    1889                 :            : 
    1890                 :            :                 case SW_PASTESDR_REPLACE:
    1891 [ #  # ][ #  # ]:          0 :                     if( rSh.IsObjSelected() )
    1892                 :            :                     {
    1893         [ #  # ]:          0 :                         rSh.ReplaceSdrObj( sURL, aEmptyStr, &aGrf );
    1894         [ #  # ]:          0 :                         Point aPt( pPt ? *pPt : rSh.GetCrsrDocPos() );
    1895         [ #  # ]:          0 :                         SwTransferable::SetSelInShell( rSh, sal_True, &aPt );
    1896                 :            :                     }
    1897                 :            :                     else
    1898         [ #  # ]:          0 :                         rSh.ReRead( sURL, aEmptyStr, &aGrf );
    1899                 :          0 :                     break;
    1900                 :            : 
    1901                 :            :                 case SW_PASTESDR_SETATTR:
    1902 [ #  # ][ #  # ]:          0 :                     if( rSh.IsObjSelected() )
    1903         [ #  # ]:          0 :                         rSh.Paste( aGrf );
    1904 [ #  # ][ #  # ]:          0 :                     else if( OBJCNT_GRF == rSh.GetObjCntTypeOfSelection() )
    1905         [ #  # ]:          0 :                         rSh.ReRead( sURL, aEmptyStr, &aGrf );
    1906                 :            :                     else
    1907                 :            :                     {
    1908         [ #  # ]:          0 :                         SwTransferable::SetSelInShell( rSh, sal_False, pPt );
    1909         [ #  # ]:          0 :                         rSh.Insert( sURL, aEmptyStr, aGrf );
    1910                 :            :                     }
    1911                 :          0 :                     break;
    1912                 :            :                 default:
    1913                 :          0 :                     nRet = 0;
    1914                 :            :                 }
    1915 [ #  # ][ #  # ]:          0 :             }
    1916                 :            :         }
    1917                 :            :         else
    1918                 :          0 :             nRet = 1;
    1919                 :            :     }
    1920                 :            : 
    1921         [ #  # ]:          0 :     if( nRet )
    1922                 :            :     {
    1923 [ #  # ][ #  # ]:          0 :         SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
    1924         [ #  # ]:          0 :         rSh.GetFlyFrmAttr( aSet );
    1925 [ #  # ][ #  # ]:          0 :         SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
    1926                 :            : 
    1927 [ #  # ][ #  # ]:          0 :         if( aURL.GetURL() != aINetImg.GetTargetURL() ||
         [ #  # ][ #  # ]
    1928         [ #  # ]:          0 :             aURL.GetTargetFrameName() != aINetImg.GetTargetFrame() )
    1929                 :            :         {
    1930         [ #  # ]:          0 :             aURL.SetURL( aINetImg.GetTargetURL(), sal_False );
    1931         [ #  # ]:          0 :             aURL.SetTargetFrameName( aINetImg.GetTargetFrame() );
    1932         [ #  # ]:          0 :             aSet.Put( aURL );
    1933         [ #  # ]:          0 :             rSh.SetFlyFrmAttr( aSet );
    1934 [ #  # ][ #  # ]:          0 :         }
    1935                 :            :     }
    1936         [ #  # ]:          0 :     return nRet;
    1937                 :            : }
    1938                 :            : 
    1939                 :          0 : void SwTransferable::SetSelInShell( SwWrtShell& rSh, sal_Bool bSelectFrm,
    1940                 :            :                                         const Point* pPt )
    1941                 :            : {
    1942         [ #  # ]:          0 :     if( bSelectFrm )
    1943                 :            :     {
    1944                 :            :         // select frames/objects
    1945 [ #  # ][ #  # ]:          0 :         if( pPt && !rSh.GetView().GetViewFrame()->GetDispatcher()->IsLocked() )
                 [ #  # ]
    1946                 :            :         {
    1947                 :          0 :             rSh.GetView().NoRotate();
    1948         [ #  # ]:          0 :             if( rSh.SelectObj( *pPt ))
    1949                 :            :             {
    1950                 :          0 :                 rSh.HideCrsr();
    1951                 :          0 :                 rSh.EnterSelFrmMode( pPt );
    1952                 :          0 :                 bFrmDrag = sal_True;
    1953                 :            :             }
    1954                 :            :         }
    1955                 :            :     }
    1956                 :            :     else
    1957                 :            :     {
    1958 [ #  # ][ #  # ]:          0 :         if( rSh.IsFrmSelected() || rSh.IsObjSelected() )
                 [ #  # ]
    1959                 :            :         {
    1960                 :          0 :             rSh.UnSelectFrm();
    1961                 :          0 :             rSh.LeaveSelFrmMode();
    1962                 :          0 :             rSh.GetView().GetEditWin().StopInsFrm();
    1963                 :          0 :             bFrmDrag = sal_False;
    1964                 :            :         }
    1965         [ #  # ]:          0 :         else if( rSh.GetView().GetDrawFuncPtr() )
    1966                 :          0 :             rSh.GetView().GetEditWin().StopInsFrm();
    1967                 :            : 
    1968                 :          0 :         rSh.EnterStdMode();
    1969         [ #  # ]:          0 :         if( pPt )
    1970                 :          0 :             rSh.SwCrsrShell::SetCrsr( *pPt, sal_True );
    1971                 :            :     }
    1972                 :          0 : }
    1973                 :            : 
    1974                 :          0 : int SwTransferable::_PasteDDE( TransferableDataHelper& rData,
    1975                 :            :                                 SwWrtShell& rWrtShell, sal_Bool bReReadGrf,
    1976                 :            :                                 sal_Bool bMsg )
    1977                 :            : {
    1978                 :            :     // data from Clipboardformat
    1979 [ #  # ][ #  # ]:          0 :     String aApp, aTopic, aItem;
                 [ #  # ]
    1980                 :            : 
    1981                 :            :     {
    1982                 :          0 :         SotStorageStreamRef xStrm;
    1983 [ #  # ][ #  # ]:          0 :         if( !rData.GetSotStorageStream( SOT_FORMATSTR_ID_LINK, xStrm ))
    1984                 :            :         {
    1985                 :            :             OSL_ENSURE( !&rWrtShell, "DDE Data not found." );
    1986                 :          0 :             return 0;
    1987                 :            :         }   // report useful error!!
    1988                 :            : 
    1989         [ #  # ]:          0 :         rtl_TextEncoding eEncoding = DDE_TXT_ENCODING;
    1990 [ #  # ][ #  # ]:          0 :         aApp = read_zeroTerminated_uInt8s_ToOUString(*xStrm, eEncoding);
    1991 [ #  # ][ #  # ]:          0 :         aTopic = read_zeroTerminated_uInt8s_ToOUString(*xStrm, eEncoding);
    1992 [ #  # ][ #  # ]:          0 :         aItem = read_zeroTerminated_uInt8s_ToOUString(*xStrm, eEncoding);
         [ #  # ][ #  # ]
    1993                 :            :     }
    1994                 :            : 
    1995         [ #  # ]:          0 :     String aCmd;
    1996         [ #  # ]:          0 :     sfx2::MakeLnkName( aCmd, &aApp, aTopic, aItem );
    1997                 :            : 
    1998                 :            :     // do we want to read in a graphic now?
    1999                 :            :     sal_uLong nFormat;
    2000 [ #  # ][ #  # ]:          0 :     if( !rData.HasFormat( FORMAT_RTF ) &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2001         [ #  # ]:          0 :         !rData.HasFormat( SOT_FORMATSTR_ID_HTML ) &&
    2002         [ #  # ]:          0 :         !rData.HasFormat( FORMAT_STRING ) &&
    2003         [ #  # ]:          0 :         (rData.HasFormat( nFormat = FORMAT_GDIMETAFILE ) ||
    2004         [ #  # ]:          0 :          rData.HasFormat( nFormat = FORMAT_BITMAP )) )
    2005                 :            :     {
    2006         [ #  # ]:          0 :         Graphic aGrf;
    2007         [ #  # ]:          0 :         int nRet = rData.GetGraphic( nFormat, aGrf );
    2008         [ #  # ]:          0 :         if( nRet )
    2009                 :            :         {
    2010                 :          0 :             rtl::OUString sLnkTyp("DDE");
    2011         [ #  # ]:          0 :             if ( bReReadGrf )
    2012 [ #  # ][ #  # ]:          0 :                 rWrtShell.ReRead( aCmd, sLnkTyp, &aGrf );
                 [ #  # ]
    2013                 :            :             else
    2014 [ #  # ][ #  # ]:          0 :                 rWrtShell.Insert( aCmd, sLnkTyp, aGrf );
                 [ #  # ]
    2015                 :            :         }
    2016         [ #  # ]:          0 :         return nRet;
    2017                 :            :     }
    2018                 :            : 
    2019                 :          0 :     SwFieldType* pTyp = 0;
    2020                 :          0 :     sal_uInt16 i = 1,j;
    2021         [ #  # ]:          0 :     String aName;
    2022                 :          0 :     sal_Bool bAlreadyThere = sal_False, bDoublePaste = sal_False;
    2023         [ #  # ]:          0 :     sal_uInt16 nSize = rWrtShell.GetFldTypeCount();
    2024         [ #  # ]:          0 :     const ::utl::TransliterationWrapper& rColl = ::GetAppCmpStrIgnore();
    2025                 :            : 
    2026 [ #  # ][ #  # ]:          0 :     do {
                 [ #  # ]
    2027         [ #  # ]:          0 :         aName = aApp;
    2028 [ #  # ][ #  # ]:          0 :         aName += String::CreateFromInt32( i );
                 [ #  # ]
    2029         [ #  # ]:          0 :         for( j = INIT_FLDTYPES; j < nSize; j++ )
    2030                 :            :         {
    2031         [ #  # ]:          0 :             pTyp = rWrtShell.GetFldType( j );
    2032         [ #  # ]:          0 :             if( RES_DDEFLD == pTyp->Which() )
    2033                 :            :             {
    2034         [ #  # ]:          0 :                 String sTmp( ((SwDDEFieldType*)pTyp)->GetCmd() );
    2035 [ #  # ][ #  # ]:          0 :                 if( rColl.isEqual( sTmp, aCmd ) &&
         [ #  # ][ #  # ]
    2036         [ #  # ]:          0 :                     sfx2::LINKUPDATE_ALWAYS == ((SwDDEFieldType*)pTyp)->GetType() )
    2037                 :            :                 {
    2038 [ #  # ][ #  # ]:          0 :                     aName = pTyp->GetName();
    2039                 :          0 :                     bDoublePaste = sal_True;
    2040                 :            :                     break;
    2041                 :            :                 }
    2042 [ #  # ][ #  # ]:          0 :                 else if( rColl.isEqual( aName, pTyp->GetName() ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2043 [ #  # ][ #  # ]:          0 :                     break;
    2044                 :            :             }
    2045                 :            :         }
    2046         [ #  # ]:          0 :         if( j == nSize )
    2047                 :          0 :             bAlreadyThere = sal_False;
    2048                 :            :         else
    2049                 :            :         {
    2050                 :          0 :             bAlreadyThere = sal_True;
    2051                 :          0 :             i++;
    2052                 :            :         }
    2053                 :            :     }
    2054                 :            :     while( bAlreadyThere && !bDoublePaste );
    2055                 :            : 
    2056         [ #  # ]:          0 :     if( !bDoublePaste )
    2057                 :            :     {
    2058         [ #  # ]:          0 :         SwDDEFieldType aType( aName, aCmd, sfx2::LINKUPDATE_ALWAYS );
    2059 [ #  # ][ #  # ]:          0 :         pTyp = rWrtShell.InsertFldType( aType );
    2060                 :            :     }
    2061                 :            : 
    2062                 :            : 
    2063                 :          0 :     SwDDEFieldType* pDDETyp = (SwDDEFieldType*)pTyp;
    2064                 :            : 
    2065         [ #  # ]:          0 :     String aExpand;
    2066 [ #  # ][ #  # ]:          0 :     if( rData.GetString( FORMAT_STRING, aExpand ))
    2067                 :            :     {
    2068                 :            :         do {            // middle checked loop
    2069                 :            : 
    2070                 :            :             // When data comes from a spreadsheet, we add a DDE-table
    2071 [ #  # ][ #  # ]:          0 :             if( ( rData.HasFormat( SOT_FORMATSTR_ID_SYLK ) ||
           [ #  #  #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2072         [ #  # ]:          0 :                   rData.HasFormat( SOT_FORMATSTR_ID_SYLK_BIGCAPS ) ) &&
    2073                 :          0 :                 aExpand.Len() &&
    2074 [ #  # ][ #  # ]:          0 :                  ( 1 < comphelper::string::getTokenCount(aExpand, '\n') ||
         [ #  # ][ #  # ]
    2075 [ #  # ][ #  # ]:          0 :                        comphelper::string::getTokenCount(aExpand, '\t') ) )
         [ #  # ][ #  # ]
    2076                 :            :             {
    2077         [ #  # ]:          0 :                 String sTmp( aExpand );
    2078 [ #  # ][ #  # ]:          0 :                 xub_StrLen nRows = comphelper::string::getTokenCount(sTmp, '\n');
    2079         [ #  # ]:          0 :                 if( nRows )
    2080                 :          0 :                     --nRows;
    2081 [ #  # ][ #  # ]:          0 :                 sTmp = sTmp.GetToken( 0, '\n' );
                 [ #  # ]
    2082 [ #  # ][ #  # ]:          0 :                 xub_StrLen nCols = comphelper::string::getTokenCount(sTmp, '\t');
    2083                 :            : 
    2084                 :            :                 // at least one column & row must be there
    2085 [ #  # ][ #  # ]:          0 :                 if( !nRows || !nCols )
    2086                 :            :                 {
    2087         [ #  # ]:          0 :                     if( bMsg )
    2088 [ #  # ][ #  # ]:          0 :                         InfoBox(0, SW_RESSTR(STR_NO_TABLE)).Execute();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2089                 :          0 :                     pDDETyp = 0;
    2090                 :            :                     break;
    2091                 :            :                 }
    2092                 :            : 
    2093                 :            :                 rWrtShell.InsertDDETable(
    2094                 :            :                     SwInsertTableOptions( tabopts::SPLIT_LAYOUT, 1 ), // TODO MULTIHEADER
    2095 [ #  # ][ #  # ]:          0 :                     pDDETyp, nRows, nCols );
                 [ #  # ]
    2096                 :            :             }
    2097 [ #  # ][ #  # ]:          0 :             else if( 1 < comphelper::string::getTokenCount(aExpand, '\n') )
                 [ #  # ]
    2098                 :            :             {
    2099                 :            :                 // multiple paragraphs -> insert a protected section
    2100 [ #  # ][ #  # ]:          0 :                 if( rWrtShell.HasSelection() )
    2101         [ #  # ]:          0 :                     rWrtShell.DelRight();
    2102                 :            : 
    2103         [ #  # ]:          0 :                 SwSectionData aSect( DDE_LINK_SECTION, aName );
    2104         [ #  # ]:          0 :                 aSect.SetLinkFileName( aCmd );
    2105                 :          0 :                 aSect.SetProtectFlag(true);
    2106         [ #  # ]:          0 :                 rWrtShell.InsertSection( aSect );
    2107                 :            : 
    2108         [ #  # ]:          0 :                 pDDETyp = 0;                // remove FieldTypes again
    2109                 :            :             }
    2110                 :            :             else
    2111                 :            :             {
    2112                 :            :                 // Einfuegen
    2113         [ #  # ]:          0 :                 SwDDEField aSwDDEField( pDDETyp );
    2114 [ #  # ][ #  # ]:          0 :                 rWrtShell.Insert( aSwDDEField );
    2115                 :            :             }
    2116                 :            : 
    2117                 :            :         } while( sal_False );
    2118                 :            :     }
    2119                 :            :     else
    2120                 :          0 :         pDDETyp = 0;                        // remove FieldTypes again
    2121                 :            : 
    2122 [ #  # ][ #  # ]:          0 :     if( !pDDETyp && !bDoublePaste )
    2123                 :            :     {
    2124                 :            :         // remove FieldType again - error occured!
    2125         [ #  # ]:          0 :         for( j = nSize; j >= INIT_FLDTYPES; --j )
    2126 [ #  # ][ #  # ]:          0 :             if( pTyp == rWrtShell.GetFldType( j ) )
    2127                 :            :             {
    2128         [ #  # ]:          0 :                 rWrtShell.RemoveFldType( j );
    2129                 :          0 :                 break;
    2130                 :            :             }
    2131                 :            :     }
    2132                 :            : 
    2133 [ #  # ][ #  # ]:          0 :     return 1;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2134                 :            : }
    2135                 :            : 
    2136                 :          0 : int SwTransferable::_PasteSdrFormat(  TransferableDataHelper& rData,
    2137                 :            :                                     SwWrtShell& rSh, sal_uInt16 nAction,
    2138                 :            :                                     const Point* pPt, sal_uInt8 nActionFlags )
    2139                 :            : {
    2140                 :          0 :     int nRet = 0;
    2141                 :          0 :     SotStorageStreamRef xStrm;
    2142 [ #  # ][ #  # ]:          0 :     if( rData.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStrm ))
    2143                 :            :     {
    2144                 :          0 :         xStrm->SetVersion( SOFFICE_FILEFORMAT_50 );
    2145         [ #  # ]:          0 :         rSh.Paste( *xStrm, nAction, pPt );
    2146                 :          0 :         nRet = 1;
    2147                 :            : 
    2148 [ #  # ][ #  # ]:          0 :         if( nRet && ( nActionFlags &
    2149                 :            :             ( EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL >> 8) ))
    2150         [ #  # ]:          0 :             SwTransferable::_PasteTargetURL( rData, rSh, 0, 0, sal_False );
    2151                 :            :     }
    2152         [ #  # ]:          0 :     return nRet;
    2153                 :            : }
    2154                 :            : 
    2155                 :          0 : int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
    2156                 :            :                                 sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt,
    2157                 :            :                                 sal_uInt8 nActionFlags, sal_Bool /*bMsg*/ )
    2158                 :            : {
    2159                 :          0 :     int nRet = 0;
    2160                 :            : 
    2161         [ #  # ]:          0 :     Graphic aGrf;
    2162         [ #  # ]:          0 :     INetBookmark aBkmk;
    2163                 :          0 :     sal_Bool bCheckForGrf = sal_False, bCheckForImageMap = sal_False;
    2164                 :            : 
    2165   [ #  #  #  # ]:          0 :     switch( nFmt )
    2166                 :            :     {
    2167                 :            :     case SOT_FORMAT_BITMAP:
    2168                 :            :     case SOT_FORMAT_GDIMETAFILE:
    2169         [ #  # ]:          0 :         nRet = rData.GetGraphic( nFmt, aGrf );
    2170                 :          0 :         break;
    2171                 :            : 
    2172                 :            :     case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
    2173                 :            :     case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR:
    2174                 :            :     case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR:
    2175 [ #  # ][ #  # ]:          0 :         if( 0 != ( nRet = rData.GetINetBookmark( nFmt, aBkmk ) ))
    2176                 :            :         {
    2177         [ #  # ]:          0 :             if( SW_PASTESDR_SETATTR == nAction )
    2178                 :          0 :                 nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK;
    2179                 :            :             else
    2180                 :          0 :                 bCheckForGrf = sal_True;
    2181                 :            :         }
    2182                 :          0 :         break;
    2183                 :            : 
    2184                 :            :     case SOT_FORMAT_FILE:
    2185                 :            :         {
    2186         [ #  # ]:          0 :             String sTxt;
    2187 [ #  # ][ #  # ]:          0 :             if( 0 != ( nRet = rData.GetString( nFmt, sTxt ) ) )
    2188                 :            :             {
    2189         [ #  # ]:          0 :                 String sDesc;
    2190         [ #  # ]:          0 :                 SwTransferable::_CheckForURLOrLNKFile( rData, sTxt, &sDesc );
    2191                 :            : 
    2192                 :            :                 aBkmk = INetBookmark(
    2193                 :            :                         URIHelper::SmartRel2Abs(INetURLObject(), sTxt, Link(), false ),
    2194 [ #  # ][ #  # ]:          0 :                         sDesc );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2195                 :          0 :                 bCheckForGrf = sal_True;
    2196         [ #  # ]:          0 :                 bCheckForImageMap = SW_PASTESDR_REPLACE == nAction;
    2197         [ #  # ]:          0 :             }
    2198                 :            :         }
    2199                 :          0 :         break;
    2200                 :            : 
    2201                 :            :     default:
    2202         [ #  # ]:          0 :         nRet = rData.GetGraphic( nFmt, aGrf );
    2203                 :          0 :         break;
    2204                 :            :     }
    2205                 :            : 
    2206         [ #  # ]:          0 :     if( bCheckForGrf )
    2207                 :            :     {
    2208                 :            :         //!!! check at FileSystem - only then it makes sense to test the graphics !!!
    2209         [ #  # ]:          0 :         GraphicFilter &rFlt = GraphicFilter::GetGraphicFilter();
    2210                 :          0 :         nRet = GRFILTER_OK == GraphicFilter::LoadGraphic( aBkmk.GetURL(), aEmptyStr,
    2211         [ #  # ]:          0 :                                             aGrf, &rFlt );
    2212 [ #  # ][ #  # ]:          0 :         if( !nRet && SW_PASTESDR_SETATTR == nAction &&
         [ #  # ][ #  # ]
                 [ #  # ]
    2213                 :            :             SOT_FORMAT_FILE == nFmt &&
    2214                 :            :             // only at frame selection
    2215         [ #  # ]:          0 :             rSh.IsFrmSelected() )
    2216                 :            :         {
    2217                 :            :             // then set as hyperlink after the graphic
    2218                 :          0 :             nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK;
    2219                 :          0 :             nRet = sal_True;
    2220                 :            :         }
    2221                 :            :     }
    2222                 :            : 
    2223         [ #  # ]:          0 :     if( nRet )
    2224                 :            :     {
    2225         [ #  # ]:          0 :         String sURL;
    2226 [ #  # ][ #  # ]:          0 :         if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
         [ #  # ][ #  # ]
    2227         [ #  # ]:          0 :             sURL = aBkmk.GetURL();
    2228                 :            : 
    2229   [ #  #  #  # ]:          0 :         switch( nAction )
    2230                 :            :         {
    2231                 :            :         case SW_PASTESDR_INSERT:
    2232         [ #  # ]:          0 :             SwTransferable::SetSelInShell( rSh, sal_False, pPt );
    2233         [ #  # ]:          0 :             rSh.Insert( sURL, aEmptyStr, aGrf );
    2234                 :          0 :         break;
    2235                 :            : 
    2236                 :            :         case SW_PASTESDR_REPLACE:
    2237 [ #  # ][ #  # ]:          0 :             if( rSh.IsObjSelected() )
    2238                 :            :             {
    2239         [ #  # ]:          0 :                 rSh.ReplaceSdrObj( sURL, aEmptyStr, &aGrf );
    2240         [ #  # ]:          0 :                 Point aPt( pPt ? *pPt : rSh.GetCrsrDocPos() );
    2241         [ #  # ]:          0 :                 SwTransferable::SetSelInShell( rSh, sal_True, &aPt );
    2242                 :            :             }
    2243                 :            :             else
    2244         [ #  # ]:          0 :                 rSh.ReRead( sURL, aEmptyStr, &aGrf );
    2245                 :          0 :             break;
    2246                 :            : 
    2247                 :            :         case SW_PASTESDR_SETATTR:
    2248         [ #  # ]:          0 :             if( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK == nFmt )
    2249                 :            :             {
    2250 [ #  # ][ #  # ]:          0 :                 if( rSh.IsFrmSelected() )
    2251                 :            :                 {
    2252 [ #  # ][ #  # ]:          0 :                     SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
    2253         [ #  # ]:          0 :                     rSh.GetFlyFrmAttr( aSet );
    2254 [ #  # ][ #  # ]:          0 :                     SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
    2255         [ #  # ]:          0 :                     aURL.SetURL( aBkmk.GetURL(), sal_False );
    2256         [ #  # ]:          0 :                     aSet.Put( aURL );
    2257 [ #  # ][ #  # ]:          0 :                     rSh.SetFlyFrmAttr( aSet );
                 [ #  # ]
    2258                 :            :                 }
    2259                 :            :             }
    2260 [ #  # ][ #  # ]:          0 :             else if( rSh.IsObjSelected() )
    2261         [ #  # ]:          0 :                 rSh.Paste( aGrf );
    2262 [ #  # ][ #  # ]:          0 :             else if( OBJCNT_GRF == rSh.GetObjCntTypeOfSelection() )
    2263         [ #  # ]:          0 :                 rSh.ReRead( sURL, aEmptyStr, &aGrf );
    2264                 :            :             else
    2265                 :            :             {
    2266         [ #  # ]:          0 :                 SwTransferable::SetSelInShell( rSh, sal_False, pPt );
    2267         [ #  # ]:          0 :                 rSh.Insert( aBkmk.GetURL(), aEmptyStr, aGrf );
    2268                 :            :             }
    2269                 :          0 :             break;
    2270                 :            :         default:
    2271                 :          0 :             nRet = 0;
    2272         [ #  # ]:          0 :         }
    2273                 :            :     }
    2274                 :            : 
    2275         [ #  # ]:          0 :     if( nRet )
    2276                 :            :     {
    2277                 :            : 
    2278         [ #  # ]:          0 :         if( nActionFlags &
    2279                 :            :             (( EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP |
    2280                 :            :                 EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP ) >> 8) )
    2281         [ #  # ]:          0 :             SwTransferable::_PasteImageMap( rData, rSh );
    2282                 :            : 
    2283         [ #  # ]:          0 :         if( nActionFlags &
    2284                 :            :             ( EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL >> 8) )
    2285         [ #  # ]:          0 :             SwTransferable::_PasteTargetURL( rData, rSh, 0, 0, sal_False );
    2286                 :            :     }
    2287         [ #  # ]:          0 :     else if( bCheckForImageMap )
    2288                 :            :     {
    2289                 :            :         // or should the file be an ImageMap-File?
    2290         [ #  # ]:          0 :         ImageMap aMap;
    2291                 :          0 :         SfxMedium aMed( INetURLObject(aBkmk.GetURL()).GetFull(),
    2292 [ #  # ][ #  # ]:          0 :                             STREAM_STD_READ );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2293         [ #  # ]:          0 :         SvStream* pStream = aMed.GetInStream();
    2294   [ #  #  #  # ]:          0 :         if( pStream != NULL  &&
           [ #  #  #  # ]
                 [ #  # ]
    2295                 :          0 :             !pStream->GetError()  &&
    2296                 :            :             // mba: no BaseURL for clipboard functionality
    2297 [ #  # ][ #  # ]:          0 :             aMap.Read( *pStream, IMAP_FORMAT_DETECT, String() ) == IMAP_ERR_OK &&
         [ #  # ][ #  # ]
                 [ #  # ]
    2298                 :          0 :             aMap.GetIMapObjectCount() )
    2299                 :            :         {
    2300 [ #  # ][ #  # ]:          0 :             SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
    2301         [ #  # ]:          0 :             rSh.GetFlyFrmAttr( aSet );
    2302 [ #  # ][ #  # ]:          0 :             SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
    2303         [ #  # ]:          0 :             aURL.SetMap( &aMap );
    2304         [ #  # ]:          0 :             aSet.Put( aURL );
    2305         [ #  # ]:          0 :             rSh.SetFlyFrmAttr( aSet );
    2306 [ #  # ][ #  # ]:          0 :             nRet = 1;
    2307 [ #  # ][ #  # ]:          0 :         }
    2308                 :            :     }
    2309                 :            : 
    2310 [ #  # ][ #  # ]:          0 :     return nRet;
    2311                 :            : }
    2312                 :            : 
    2313                 :          0 : int SwTransferable::_PasteImageMap( TransferableDataHelper& rData,
    2314                 :            :                                     SwWrtShell& rSh )
    2315                 :            : {
    2316                 :          0 :     int nRet = 0;
    2317         [ #  # ]:          0 :     if( rData.HasFormat( SOT_FORMATSTR_ID_SVIM ))
    2318                 :            :     {
    2319 [ #  # ][ #  # ]:          0 :         SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
    2320         [ #  # ]:          0 :         rSh.GetFlyFrmAttr( aSet );
    2321 [ #  # ][ #  # ]:          0 :         SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
    2322                 :          0 :         const ImageMap* pOld = aURL.GetMap();
    2323                 :            : 
    2324                 :            :         // set or replace, that is the question
    2325         [ #  # ]:          0 :         ImageMap aImageMap;
    2326 [ #  # ][ #  # ]:          0 :         if( rData.GetImageMap( SOT_FORMATSTR_ID_SVIM, aImageMap ) &&
         [ #  # ][ #  # ]
                 [ #  # ]
    2327         [ #  # ]:          0 :             ( !pOld || aImageMap != *pOld ))
    2328                 :            :         {
    2329         [ #  # ]:          0 :             aURL.SetMap( &aImageMap );
    2330         [ #  # ]:          0 :             aSet.Put( aURL );
    2331         [ #  # ]:          0 :             rSh.SetFlyFrmAttr( aSet );
    2332                 :            :         }
    2333 [ #  # ][ #  # ]:          0 :         nRet = 1;
                 [ #  # ]
    2334                 :            :     }
    2335                 :          0 :     return nRet;
    2336                 :            : }
    2337                 :            : 
    2338                 :          0 : int SwTransferable::_PasteAsHyperlink( TransferableDataHelper& rData,
    2339                 :            :                                         SwWrtShell& rSh, sal_uLong nFmt )
    2340                 :            : {
    2341                 :          0 :     int nRet = 0;
    2342         [ #  # ]:          0 :     String sFile;
    2343 [ #  # ][ #  # ]:          0 :     if( rData.GetString( nFmt, sFile ) && sFile.Len() )
         [ #  # ][ #  # ]
    2344                 :            :     {
    2345         [ #  # ]:          0 :         String sDesc;
    2346         [ #  # ]:          0 :         SwTransferable::_CheckForURLOrLNKFile( rData, sFile, &sDesc );
    2347                 :            : 
    2348                 :            :         // first, make the URL absolute
    2349         [ #  # ]:          0 :         INetURLObject aURL;
    2350                 :          0 :         aURL.SetSmartProtocol( INET_PROT_FILE );
    2351 [ #  # ][ #  # ]:          0 :         aURL.SetSmartURL( sFile );
    2352 [ #  # ][ #  # ]:          0 :         sFile = aURL.GetMainURL( INetURLObject::NO_DECODE );
    2353                 :            : 
    2354 [ #  # ][ #  # ]:          0 :         switch( rSh.GetObjCntTypeOfSelection() )
    2355                 :            :         {
    2356                 :            :         case OBJCNT_FLY:
    2357                 :            :         case OBJCNT_GRF:
    2358                 :            :         case OBJCNT_OLE:
    2359                 :            :             {
    2360 [ #  # ][ #  # ]:          0 :                 SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
    2361         [ #  # ]:          0 :                 rSh.GetFlyFrmAttr( aSet );
    2362 [ #  # ][ #  # ]:          0 :                 SwFmtURL aURL2( (SwFmtURL&)aSet.Get( RES_URL ) );
    2363         [ #  # ]:          0 :                 aURL2.SetURL( sFile, sal_False );
    2364         [ #  # ]:          0 :                 if( !aURL2.GetName().Len() )
    2365         [ #  # ]:          0 :                     aURL2.SetName( sFile );
    2366         [ #  # ]:          0 :                 aSet.Put( aURL2 );
    2367 [ #  # ][ #  # ]:          0 :                 rSh.SetFlyFrmAttr( aSet );
                 [ #  # ]
    2368                 :            :             }
    2369                 :          0 :             break;
    2370                 :            : 
    2371                 :            :         default:
    2372                 :            :             {
    2373                 :            :                 rSh.InsertURL( SwFmtINetFmt( sFile, aEmptyStr ),
    2374 [ #  # ][ #  # ]:          0 :                                 sDesc.Len() ? sDesc : sFile );
         [ #  # ][ #  # ]
    2375                 :            :             }
    2376                 :            :         }
    2377 [ #  # ][ #  # ]:          0 :         nRet = sal_True;
    2378                 :            :     }
    2379         [ #  # ]:          0 :     return nRet;
    2380                 :            : }
    2381                 :            : 
    2382                 :          0 : int SwTransferable::_PasteFileName( TransferableDataHelper& rData,
    2383                 :            :                                     SwWrtShell& rSh, sal_uLong nFmt,
    2384                 :            :                                     sal_uInt16 nAction, const Point* pPt,
    2385                 :            :                                     sal_uInt8 nActionFlags, sal_Bool bMsg )
    2386                 :            : {
    2387                 :            :     int nRet = SwTransferable::_PasteGrf( rData, rSh, nFmt, nAction,
    2388                 :          0 :                                             pPt, nActionFlags, bMsg );
    2389         [ #  # ]:          0 :     if( nRet )
    2390                 :          0 :         nRet |= SWTRANSFER_GRAPHIC_INSERTED;
    2391         [ #  # ]:          0 :     if( !nRet )
    2392                 :            :     {
    2393 [ #  # ][ #  # ]:          0 :         String sFile, sDesc;
    2394 [ #  # ][ #  # ]:          0 :         if( rData.GetString( nFmt, sFile ) && sFile.Len() )
         [ #  # ][ #  # ]
    2395                 :            :         {
    2396         [ #  # ]:          0 :             INetURLObject aMediaURL;
    2397                 :            : 
    2398 [ #  # ][ #  # ]:          0 :             aMediaURL.SetSmartURL( sFile );
    2399 [ #  # ][ #  # ]:          0 :             const String aMediaURLStr( aMediaURL.GetMainURL( INetURLObject::NO_DECODE ) );
    2400                 :            : 
    2401 [ #  # ][ #  # ]:          0 :             if( ::avmedia::MediaWindow::isMediaURL( aMediaURLStr ) )
                 [ #  # ]
    2402                 :            :             {
    2403         [ #  # ]:          0 :                 const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, aMediaURLStr );
    2404                 :          0 :                 rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(
    2405                 :            :                                 SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON,
    2406 [ #  # ][ #  # ]:          0 :                                 &aMediaURLItem, 0L );
    2407                 :            :             }
    2408                 :            :             else
    2409                 :            :             {
    2410         [ #  # ]:          0 :                 sal_Bool bIsURLFile = SwTransferable::_CheckForURLOrLNKFile( rData, sFile, &sDesc );
    2411                 :            : 
    2412                 :            :                 //Own FileFormat? --> insert, not for StarWriter/Web
    2413 [ #  # ][ #  # ]:          0 :                 String sFileURL = URIHelper::SmartRel2Abs(INetURLObject(), sFile, Link(), false );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2414                 :            :                 const SfxFilter* pFlt = SW_PASTESDR_SETATTR == nAction
    2415                 :            :                         ? 0 : SwIoSystem::GetFileFilter(
    2416 [ #  # ][ #  # ]:          0 :                         sFileURL, aEmptyStr );
    2417 [ #  # ][ #  # ]:          0 :                 if( pFlt && !rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2418                 :            :                 {
    2419                 :            :     // and then pull up the insert-region-dialog by PostUser event
    2420                 :            :                     SwSectionData * pSect = new SwSectionData(
    2421                 :            :                                     FILE_LINK_SECTION,
    2422 [ #  # ][ #  # ]:          0 :                                     rSh.GetDoc()->GetUniqueSectionName() );
         [ #  # ][ #  # ]
    2423         [ #  # ]:          0 :                     pSect->SetLinkFileName( sFileURL );
    2424                 :          0 :                     pSect->SetProtectFlag( true );
    2425                 :            : 
    2426                 :            :                     Application::PostUserEvent( STATIC_LINK( &rSh, SwWrtShell,
    2427 [ #  # ][ #  # ]:          0 :                                                 InsertRegionDialog ), pSect );
    2428                 :          0 :                     nRet = 1;
    2429                 :            :                     }
    2430 [ #  # ][ #  # ]:          0 :                 else if( SW_PASTESDR_SETATTR == nAction ||
                 [ #  # ]
    2431                 :            :                         ( bIsURLFile && SW_PASTESDR_INSERT == nAction ))
    2432                 :            :                 {
    2433                 :            :                     //we can insert foreign files as links after all
    2434                 :            : 
    2435                 :            :                     // first, make the URL absolute
    2436         [ #  # ]:          0 :                     INetURLObject aURL;
    2437                 :          0 :                     aURL.SetSmartProtocol( INET_PROT_FILE );
    2438 [ #  # ][ #  # ]:          0 :                     aURL.SetSmartURL( sFile );
    2439 [ #  # ][ #  # ]:          0 :                     sFile = aURL.GetMainURL( INetURLObject::NO_DECODE );
    2440                 :            : 
    2441 [ #  # ][ #  # ]:          0 :                     switch( rSh.GetObjCntTypeOfSelection() )
    2442                 :            :                     {
    2443                 :            :                     case OBJCNT_FLY:
    2444                 :            :                     case OBJCNT_GRF:
    2445                 :            :                     case OBJCNT_OLE:
    2446                 :            :                         {
    2447 [ #  # ][ #  # ]:          0 :                             SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
    2448         [ #  # ]:          0 :                             rSh.GetFlyFrmAttr( aSet );
    2449 [ #  # ][ #  # ]:          0 :                             SwFmtURL aURL2( (SwFmtURL&)aSet.Get( RES_URL ) );
    2450         [ #  # ]:          0 :                             aURL2.SetURL( sFile, sal_False );
    2451         [ #  # ]:          0 :                             if( !aURL2.GetName().Len() )
    2452         [ #  # ]:          0 :                                 aURL2.SetName( sFile );
    2453         [ #  # ]:          0 :                             aSet.Put( aURL2 );
    2454 [ #  # ][ #  # ]:          0 :                             rSh.SetFlyFrmAttr( aSet );
                 [ #  # ]
    2455                 :            :                         }
    2456                 :          0 :                         break;
    2457                 :            : 
    2458                 :            :                     default:
    2459                 :            :                         {
    2460                 :            :                             rSh.InsertURL( SwFmtINetFmt( sFile, aEmptyStr ),
    2461 [ #  # ][ #  # ]:          0 :                                             sDesc.Len() ? sDesc : sFile );
         [ #  # ][ #  # ]
    2462                 :            :                         }
    2463                 :            :                     }
    2464         [ #  # ]:          0 :                     nRet = sal_True;
    2465         [ #  # ]:          0 :                 }
    2466 [ #  # ][ #  # ]:          0 :             }
    2467 [ #  # ][ #  # ]:          0 :         }
    2468                 :            :     }
    2469                 :          0 :     return nRet;
    2470                 :            : }
    2471                 :            : 
    2472                 :          0 : int SwTransferable::_PasteDBData( TransferableDataHelper& rData,
    2473                 :            :                                     SwWrtShell& rSh, sal_uLong nFmt, sal_Bool bLink,
    2474                 :            :                                     const Point* pDragPt, sal_Bool bMsg )
    2475                 :            : {
    2476                 :          0 :     int nRet = 0;
    2477         [ #  # ]:          0 :     String sTxt;
    2478 [ #  # ][ #  # ]:          0 :     if( rData.GetString( nFmt, sTxt ) && sTxt.Len() )
         [ #  # ][ #  # ]
    2479                 :            :     {
    2480                 :            :         sal_uInt16 nWh = SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE == nFmt
    2481                 :            :                     ? 0
    2482                 :            :                     : SOT_FORMATSTR_ID_SBA_DATAEXCHANGE == nFmt
    2483                 :            :                                 ? (bLink
    2484                 :            :                                     ? FN_QRY_MERGE_FIELD
    2485                 :            :                                     : FN_QRY_INSERT)
    2486                 :            :                                 : (bLink
    2487                 :            :                                     ? 0
    2488 [ #  # ][ #  # ]:          0 :                                     : FN_QRY_INSERT_FIELD );
         [ #  # ][ #  # ]
    2489                 :          0 :         DataFlavorExVector& rVector = rData.GetDataFlavorExVector();
    2490         [ #  # ]:          0 :         sal_Bool bHaveColumnDescriptor = OColumnTransferable::canExtractColumnDescriptor(rVector, CTF_COLUMN_DESCRIPTOR | CTF_CONTROL_EXCHANGE);
    2491         [ #  # ]:          0 :         if ( SOT_FORMATSTR_ID_XFORMS == nFmt )
    2492                 :            :         {
    2493                 :            :             SdrObject* pObj;
    2494         [ #  # ]:          0 :             rSh.MakeDrawView();
    2495 [ #  # ][ #  # ]:          0 :             FmFormView* pFmView = PTR_CAST( FmFormView, rSh.GetDrawView() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2496         [ #  # ]:          0 :             if(pFmView) {
    2497         [ #  # ]:          0 :                 const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData);
    2498 [ #  # ][ #  # ]:          0 :                 if(0 != (pObj = pFmView->CreateXFormsControl(rDesc)))
    2499                 :            :                 {
    2500         [ #  # ]:          0 :                     rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
    2501                 :            :                 }
    2502                 :            :             }
    2503                 :            :         }
    2504         [ #  # ]:          0 :         else if( nWh )
    2505                 :            :         {
    2506                 :          0 :             SfxUsrAnyItem* pConnectionItem  = 0;
    2507                 :          0 :             SfxUsrAnyItem* pCursorItem      = 0;
    2508                 :          0 :             SfxUsrAnyItem* pColumnItem      = 0;
    2509                 :          0 :             SfxUsrAnyItem* pSourceItem      = 0;
    2510                 :          0 :             SfxUsrAnyItem* pCommandItem     = 0;
    2511                 :          0 :             SfxUsrAnyItem* pCommandTypeItem = 0;
    2512                 :          0 :             SfxUsrAnyItem* pColumnNameItem  = 0;
    2513                 :          0 :             SfxUsrAnyItem* pSelectionItem   = 0;
    2514                 :            : 
    2515                 :          0 :             sal_Bool bDataAvailable = sal_True;
    2516         [ #  # ]:          0 :             ODataAccessDescriptor aDesc;
    2517         [ #  # ]:          0 :             if(bHaveColumnDescriptor)
    2518 [ #  # ][ #  # ]:          0 :                 aDesc = OColumnTransferable::extractColumnDescriptor(rData);
                 [ #  # ]
    2519 [ #  # ][ #  # ]:          0 :             else if(ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) )
    2520 [ #  # ][ #  # ]:          0 :                 aDesc = ODataAccessObjectTransferable::extractObjectDescriptor(rData);
                 [ #  # ]
    2521                 :            :             else
    2522                 :          0 :                 bDataAvailable = sal_False;
    2523                 :            : 
    2524         [ #  # ]:          0 :             if ( bDataAvailable )
    2525                 :            :             {
    2526 [ #  # ][ #  # ]:          0 :                 pConnectionItem = new SfxUsrAnyItem(FN_DB_CONNECTION_ANY, aDesc[daConnection]);
                 [ #  # ]
    2527 [ #  # ][ #  # ]:          0 :                 pColumnItem = new SfxUsrAnyItem(FN_DB_COLUMN_ANY, aDesc[daColumnObject]);
                 [ #  # ]
    2528 [ #  # ][ #  # ]:          0 :                 pSourceItem = new SfxUsrAnyItem(FN_DB_DATA_SOURCE_ANY, makeAny(aDesc.getDataSource()));
         [ #  # ][ #  # ]
    2529 [ #  # ][ #  # ]:          0 :                 pCommandItem = new SfxUsrAnyItem(FN_DB_DATA_COMMAND_ANY, aDesc[daCommand]);
                 [ #  # ]
    2530 [ #  # ][ #  # ]:          0 :                 pCommandTypeItem = new SfxUsrAnyItem(FN_DB_DATA_COMMAND_TYPE_ANY, aDesc[daCommandType]);
                 [ #  # ]
    2531 [ #  # ][ #  # ]:          0 :                 pColumnNameItem = new SfxUsrAnyItem(FN_DB_DATA_COLUMN_NAME_ANY, aDesc[daColumnName]);
                 [ #  # ]
    2532 [ #  # ][ #  # ]:          0 :                 pSelectionItem = new SfxUsrAnyItem(FN_DB_DATA_SELECTION_ANY, aDesc[daSelection]);
                 [ #  # ]
    2533 [ #  # ][ #  # ]:          0 :                 pCursorItem = new SfxUsrAnyItem(FN_DB_DATA_CURSOR_ANY, aDesc[daCursor]);
                 [ #  # ]
    2534                 :            :             }
    2535                 :            : 
    2536                 :          0 :             SwView& rView = rSh.GetView();
    2537                 :            :             //force ::SelectShell
    2538         [ #  # ]:          0 :             rView.StopShellTimer();
    2539                 :            : 
    2540         [ #  # ]:          0 :             SfxStringItem aDataDesc( nWh, sTxt );
    2541                 :            :             rView.GetViewFrame()->GetDispatcher()->Execute(
    2542                 :            :                                 nWh, SFX_CALLMODE_ASYNCHRON, &aDataDesc,
    2543                 :            :                                 pConnectionItem, pColumnItem,
    2544                 :            :                                 pSourceItem, pCommandItem, pCommandTypeItem,
    2545         [ #  # ]:          0 :                                 pColumnNameItem, pSelectionItem, pCursorItem,0L);
    2546 [ #  # ][ #  # ]:          0 :             delete pConnectionItem;
    2547 [ #  # ][ #  # ]:          0 :             delete pColumnItem;
    2548 [ #  # ][ #  # ]:          0 :             delete pSourceItem;
    2549 [ #  # ][ #  # ]:          0 :             delete pCommandItem;
    2550 [ #  # ][ #  # ]:          0 :             delete pCommandTypeItem;
    2551 [ #  # ][ #  # ]:          0 :             delete pColumnNameItem;
    2552 [ #  # ][ #  # ]:          0 :             delete pCursorItem;
         [ #  # ][ #  # ]
    2553                 :            :         }
    2554                 :            :         else
    2555                 :            :         {
    2556                 :            :             SdrObject* pObj;
    2557         [ #  # ]:          0 :             rSh.MakeDrawView();
    2558 [ #  # ][ #  # ]:          0 :             FmFormView* pFmView = PTR_CAST( FmFormView, rSh.GetDrawView() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2559 [ #  # ][ #  # ]:          0 :             if (pFmView && bHaveColumnDescriptor)
    2560                 :            :             {
    2561 [ #  # ][ #  # ]:          0 :                 if ( 0 != (pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) ) ) )
         [ #  # ][ #  # ]
    2562         [ #  # ]:          0 :                     rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
    2563                 :            :             }
    2564                 :            :         }
    2565                 :          0 :         nRet = 1;
    2566                 :            :     }
    2567         [ #  # ]:          0 :     else if( bMsg )
    2568                 :            :     {
    2569 [ #  # ][ #  # ]:          0 :         InfoBox( 0, SW_RES(MSG_CLPBRD_FORMAT_ERROR)).Execute();
                 [ #  # ]
    2570                 :            :     }
    2571         [ #  # ]:          0 :     return nRet;
    2572                 :            : }
    2573                 :            : 
    2574                 :          0 : int SwTransferable::_PasteFileList( TransferableDataHelper& rData,
    2575                 :            :                                     SwWrtShell& rSh, sal_Bool bLink,
    2576                 :            :                                     const Point* pPt, sal_Bool bMsg )
    2577                 :            : {
    2578                 :          0 :     int nRet = 0;
    2579         [ #  # ]:          0 :     FileList aFileList;
    2580 [ #  # ][ #  # ]:          0 :     if( rData.GetFileList( SOT_FORMAT_FILE_LIST, aFileList ) &&
         [ #  # ][ #  # ]
    2581         [ #  # ]:          0 :         aFileList.Count() )
    2582                 :            :     {
    2583         [ #  # ]:          0 :         sal_uInt16 nAct = bLink ? SW_PASTESDR_SETATTR : SW_PASTESDR_INSERT;
    2584         [ #  # ]:          0 :         String sFlyNm;
    2585                 :            :         // iterate over the filelist
    2586 [ #  # ][ #  # ]:          0 :         for( sal_uLong n = 0, nEnd = aFileList.Count(); n < nEnd; ++n )
    2587                 :            :         {
    2588         [ #  # ]:          0 :             TransferDataContainer* pHlp = new TransferDataContainer;
    2589 [ #  # ][ #  # ]:          0 :             pHlp->CopyString( FORMAT_FILE, aFileList.GetFile( n ));
                 [ #  # ]
    2590 [ #  # ][ #  # ]:          0 :             TransferableDataHelper aData( pHlp );
                 [ #  # ]
    2591                 :            : 
    2592         [ #  # ]:          0 :             if( SwTransferable::_PasteFileName( aData, rSh, SOT_FORMAT_FILE, nAct,
    2593         [ #  # ]:          0 :                                             pPt, sal_False, bMsg ))
    2594                 :            :             {
    2595         [ #  # ]:          0 :                 if( bLink )
    2596                 :            :                 {
    2597 [ #  # ][ #  # ]:          0 :                     sFlyNm = rSh.GetFlyName();
    2598         [ #  # ]:          0 :                     SwTransferable::SetSelInShell( rSh, sal_False, pPt );
    2599                 :            :                 }
    2600                 :          0 :                 nRet = 1;
    2601                 :            :             }
    2602         [ #  # ]:          0 :         }
    2603         [ #  # ]:          0 :         if( sFlyNm.Len() )
    2604 [ #  # ][ #  # ]:          0 :             rSh.GotoFly( sFlyNm );
    2605                 :            :     }
    2606         [ #  # ]:          0 :     else if( bMsg )
    2607                 :            :     {
    2608 [ #  # ][ #  # ]:          0 :         InfoBox( 0, SW_RES(MSG_CLPBRD_FORMAT_ERROR)).Execute();
                 [ #  # ]
    2609                 :            :     }
    2610         [ #  # ]:          0 :     return nRet;
    2611                 :            : }
    2612                 :            : 
    2613                 :          0 : sal_Bool SwTransferable::_CheckForURLOrLNKFile( TransferableDataHelper& rData,
    2614                 :            :                                         String& rFileName, String* pTitle )
    2615                 :            : {
    2616                 :          0 :     sal_Bool bIsURLFile = sal_False;
    2617         [ #  # ]:          0 :     INetBookmark aBkmk;
    2618 [ #  # ][ #  # ]:          0 :     if( rData.GetINetBookmark( SOT_FORMATSTR_ID_SOLK, aBkmk ) )
    2619                 :            :     {
    2620         [ #  # ]:          0 :         rFileName = aBkmk.GetURL();
    2621         [ #  # ]:          0 :         if( pTitle )
    2622         [ #  # ]:          0 :             *pTitle = aBkmk.GetDescription();
    2623                 :          0 :         bIsURLFile = sal_True;
    2624                 :            :     }
    2625                 :            :     else
    2626                 :            :     {
    2627                 :          0 :         xub_StrLen nLen = rFileName.Len();
    2628 [ #  # ][ #  # ]:          0 :         if( 4 < nLen && '.' == rFileName.GetChar( nLen - 4 ))
                 [ #  # ]
    2629                 :            :         {
    2630         [ #  # ]:          0 :             String sExt( rFileName.Copy( nLen - 3 ));
    2631         [ #  # ]:          0 :             if( sExt.EqualsIgnoreCaseAscii( "url" ))
    2632                 :            :             {
    2633                 :            :                 OSL_ENSURE( !&rFileName, "how do we read today .URL - Files?" );
    2634         [ #  # ]:          0 :             }
    2635                 :            :         }
    2636                 :            :     }
    2637         [ #  # ]:          0 :     return bIsURLFile;
    2638                 :            : }
    2639                 :            : 
    2640                 :          0 : sal_Bool SwTransferable::IsPasteSpecial( const SwWrtShell& rWrtShell,
    2641                 :            :                                      const TransferableDataHelper& rData )
    2642                 :            : {
    2643                 :            :     // we can paste-special if there's an entry in the paste-special-format list
    2644         [ #  # ]:          0 :     SvxClipboardFmtItem aClipboardFmtItem(0);
    2645         [ #  # ]:          0 :     FillClipFmtItem( rWrtShell, rData, aClipboardFmtItem);
    2646 [ #  # ][ #  # ]:          0 :     return aClipboardFmtItem.Count() > 0;
    2647                 :            : }
    2648                 :            : 
    2649                 :          0 : int SwTransferable::PasteFormat( SwWrtShell& rSh,
    2650                 :            :                                     TransferableDataHelper& rData,
    2651                 :            :                                     sal_uLong nFormat )
    2652                 :            : {
    2653 [ #  # ][ #  # ]:          0 :     SwWait aWait( *rSh.GetView().GetDocShell(), sal_False );
    2654                 :          0 :     int nRet = 0;
    2655                 :            : 
    2656                 :          0 :     sal_uLong nPrivateFmt = FORMAT_PRIVATE;
    2657         [ #  # ]:          0 :     SwTransferable *pClipboard = GetSwTransferable( rData );
    2658 [ #  # ][ #  # ]:          0 :     if( pClipboard &&
    2659                 :            :         ((TRNSFR_DOCUMENT|TRNSFR_GRAPHIC|TRNSFR_OLE) & pClipboard->eBufferType ))
    2660                 :          0 :         nPrivateFmt = SOT_FORMATSTR_ID_EMBED_SOURCE;
    2661                 :            : 
    2662 [ #  # ][ #  # ]:          0 :     if( pClipboard && nPrivateFmt == nFormat )
    2663         [ #  # ]:          0 :         nRet = pClipboard->PrivatePaste( rSh );
    2664 [ #  # ][ #  # ]:          0 :     else if( rData.HasFormat( nFormat ) )
    2665                 :            :     {
    2666         [ #  # ]:          0 :         uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() );
    2667                 :            :         sal_uInt16 nEventAction,
    2668         [ #  # ]:          0 :                nDestination = SwTransferable::GetSotDestination( rSh ),
    2669                 :            :                nSourceOptions =
    2670                 :            :                     (( EXCHG_DEST_DOC_TEXTFRAME == nDestination ||
    2671                 :            :                        EXCHG_DEST_SWDOC_FREE_AREA == nDestination ||
    2672                 :            :                        EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination ||
    2673                 :            :                        EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination )
    2674                 :            :                                         ? EXCHG_IN_ACTION_COPY
    2675 [ #  # ][ #  # ]:          0 :                                         : EXCHG_IN_ACTION_MOVE),
         [ #  # ][ #  # ]
    2676                 :            :                nAction = SotExchange::GetExchangeAction(
    2677                 :          0 :                                     rData.GetDataFlavorExVector(),
    2678                 :            :                                     nDestination,
    2679                 :            :                                     nSourceOptions,             /* ?? */
    2680                 :            :                                     EXCHG_IN_ACTION_DEFAULT,    /* ?? */
    2681                 :            :                                     nFormat, nEventAction, nFormat,
    2682         [ #  # ]:          0 :                                     lcl_getTransferPointer ( xTransferable ) );
    2683                 :            : 
    2684         [ #  # ]:          0 :         if( EXCHG_INOUT_ACTION_NONE != nAction )
    2685                 :            :             nRet = SwTransferable::PasteData( rData, rSh, nAction, nFormat,
    2686         [ #  # ]:          0 :                                                 nDestination, sal_True, sal_False );
    2687                 :            :     }
    2688         [ #  # ]:          0 :     return nRet;
    2689                 :            : }
    2690                 :            : 
    2691                 :      44560 : int SwTransferable::_TestAllowedFormat( const TransferableDataHelper& rData,
    2692                 :            :                                         sal_uLong nFormat, sal_uInt16 nDestination )
    2693                 :            : {
    2694                 :      44560 :     sal_uInt16 nAction = EXCHG_INOUT_ACTION_NONE, nEventAction;
    2695 [ +  - ][ -  + ]:      44560 :     if( rData.HasFormat( nFormat )) {
    2696         [ #  # ]:          0 :         uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() );
    2697                 :            :         nAction = SotExchange::GetExchangeAction(
    2698                 :          0 :                         rData.GetDataFlavorExVector(),
    2699                 :            :                         nDestination, EXCHG_IN_ACTION_COPY,
    2700                 :            :                         EXCHG_IN_ACTION_COPY, nFormat,
    2701                 :            :                         nEventAction, nFormat,
    2702         [ #  # ]:          0 :                         lcl_getTransferPointer ( xTransferable ) );
    2703                 :            :     }
    2704                 :      44560 :     return EXCHG_INOUT_ACTION_NONE != nAction;
    2705                 :            : }
    2706                 :            : 
    2707                 :            : /**
    2708                 :            :  * the list of formats which will be offered to the user in the 'Paste
    2709                 :            :  * Special...' dialog and the paste button menu
    2710                 :            :  */
    2711                 :            : static sal_uInt16 aPasteSpecialIds[] =
    2712                 :            : {
    2713                 :            :     SOT_FORMATSTR_ID_HTML,
    2714                 :            :     SOT_FORMATSTR_ID_HTML_SIMPLE,
    2715                 :            :     SOT_FORMATSTR_ID_HTML_NO_COMMENT,
    2716                 :            :     FORMAT_RTF,
    2717                 :            :     FORMAT_STRING,
    2718                 :            :     SOT_FORMATSTR_ID_SONLK,
    2719                 :            :     SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK,
    2720                 :            :     SOT_FORMATSTR_ID_DRAWING,
    2721                 :            :     SOT_FORMATSTR_ID_SVXB,
    2722                 :            :     FORMAT_GDIMETAFILE,
    2723                 :            :     FORMAT_BITMAP,
    2724                 :            :     SOT_FORMATSTR_ID_SVIM,
    2725                 :            :     SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR,
    2726                 :            :     0
    2727                 :            : };
    2728                 :            : 
    2729                 :          0 : int SwTransferable::PasteUnformatted( SwWrtShell& rSh, TransferableDataHelper& rData )
    2730                 :            : {
    2731                 :            :     // Plain text == unformatted
    2732                 :          0 :     return SwTransferable::PasteFormat( rSh, rData, SOT_FORMAT_STRING );
    2733                 :            : }
    2734                 :            : 
    2735                 :          0 : int SwTransferable::PasteSpecial( SwWrtShell& rSh, TransferableDataHelper& rData, sal_uLong& rFormatUsed )
    2736                 :            : {
    2737                 :          0 :     int nRet = 0;
    2738         [ #  # ]:          0 :     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
    2739         [ #  # ]:          0 :     SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( &rSh.GetView().GetEditWin() );
    2740                 :            : 
    2741         [ #  # ]:          0 :     DataFlavorExVector aFormats( rData.GetDataFlavorExVector() );
    2742         [ #  # ]:          0 :     TransferableObjectDescriptor aDesc;
    2743                 :            : 
    2744         [ #  # ]:          0 :     sal_uInt16 nDest = SwTransferable::GetSotDestination( rSh );
    2745                 :            : 
    2746         [ #  # ]:          0 :     SwTransferable *pClipboard = GetSwTransferable( rData );
    2747         [ #  # ]:          0 :     if( pClipboard )
    2748                 :            :     {
    2749         [ #  # ]:          0 :         aDesc = pClipboard->aObjDesc;
    2750                 :            :         sal_uInt16 nResId;
    2751         [ #  # ]:          0 :         if( pClipboard->eBufferType & TRNSFR_DOCUMENT )
    2752                 :          0 :             nResId = STR_PRIVATETEXT;
    2753         [ #  # ]:          0 :         else if( pClipboard->eBufferType & TRNSFR_GRAPHIC )
    2754                 :          0 :             nResId = STR_PRIVATEGRAPHIC;
    2755         [ #  # ]:          0 :         else if( pClipboard->eBufferType == TRNSFR_OLE )
    2756                 :          0 :             nResId = STR_PRIVATEOLE;
    2757                 :            :         else
    2758                 :          0 :             nResId = 0;
    2759                 :            : 
    2760         [ #  # ]:          0 :         if( nResId )
    2761                 :            :         {
    2762 [ #  # ][ #  # ]:          0 :             if( STR_PRIVATEOLE == nResId || STR_PRIVATEGRAPHIC == nResId )
    2763                 :            :             {
    2764                 :            :                 // add SOT_FORMATSTR_ID_EMBED_SOURCE to the formats. This
    2765                 :            :                 // format display then the private format name.
    2766                 :          0 :                 DataFlavorEx aFlavorEx;
    2767                 :          0 :                 aFlavorEx.mnSotId = SOT_FORMATSTR_ID_EMBED_SOURCE;
    2768         [ #  # ]:          0 :                 aFormats.insert( aFormats.begin(), aFlavorEx );
    2769                 :            :             }
    2770                 :            :             pDlg->SetObjName( pClipboard->aObjDesc.maClassName,
    2771 [ #  # ][ #  # ]:          0 :                                 SW_RES( nResId ) );
                 [ #  # ]
    2772         [ #  # ]:          0 :             pDlg->Insert( SOT_FORMATSTR_ID_EMBED_SOURCE, aEmptyStr );
    2773                 :            :         }
    2774                 :            :     }
    2775                 :            :     else
    2776                 :            :     {
    2777 [ #  # ][ #  # ]:          0 :         if( rData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
    2778                 :            :             rData.GetTransferableObjectDescriptor(
    2779         [ #  # ]:          0 :                                 SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc );
    2780                 :            : 
    2781 [ #  # ][ #  # ]:          0 :         if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_EMBED_SOURCE, nDest ))
    2782         [ #  # ]:          0 :             pDlg->Insert( SOT_FORMATSTR_ID_EMBED_SOURCE, aEmptyStr );
    2783 [ #  # ][ #  # ]:          0 :         if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_LINK_SOURCE, nDest ))
    2784         [ #  # ]:          0 :             pDlg->Insert( SOT_FORMATSTR_ID_LINK_SOURCE, aEmptyStr );
    2785                 :            :     }
    2786                 :            : 
    2787 [ #  # ][ #  # ]:          0 :     if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_LINK, nDest ))
    2788 [ #  # ][ #  # ]:          0 :         pDlg->Insert( SOT_FORMATSTR_ID_LINK, SW_RES(STR_DDEFORMAT) );
                 [ #  # ]
    2789                 :            : 
    2790         [ #  # ]:          0 :     for( sal_uInt16* pIds = aPasteSpecialIds; *pIds; ++pIds )
    2791 [ #  # ][ #  # ]:          0 :         if( SwTransferable::_TestAllowedFormat( rData, *pIds, nDest ))
    2792         [ #  # ]:          0 :             pDlg->Insert( *pIds, aEmptyStr );
    2793                 :            : 
    2794 [ #  # ][ #  # ]:          0 :     sal_uLong nFormat = pDlg->GetFormat( rData.GetTransferable() );
                 [ #  # ]
    2795                 :            : 
    2796         [ #  # ]:          0 :     if( nFormat )
    2797         [ #  # ]:          0 :         nRet = SwTransferable::PasteFormat( rSh, rData, nFormat );
    2798                 :            : 
    2799         [ #  # ]:          0 :     if ( nRet )
    2800                 :          0 :         rFormatUsed = nFormat;
    2801                 :            : 
    2802 [ #  # ][ #  # ]:          0 :     delete pDlg;
    2803         [ #  # ]:          0 :     return nRet;
    2804                 :            : }
    2805                 :            : 
    2806                 :       2785 : void SwTransferable::FillClipFmtItem( const SwWrtShell& rSh,
    2807                 :            :                                 const TransferableDataHelper& rData,
    2808                 :            :                                 SvxClipboardFmtItem & rToFill )
    2809                 :            : {
    2810                 :       2785 :     sal_uInt16 nDest = SwTransferable::GetSotDestination( rSh );
    2811                 :            : 
    2812                 :       2785 :     SwTransferable *pClipboard = GetSwTransferable( rData );
    2813         [ -  + ]:       2785 :     if( pClipboard )
    2814                 :            :     {
    2815                 :            :         sal_uInt16 nResId;
    2816         [ #  # ]:          0 :         if( pClipboard->eBufferType & TRNSFR_DOCUMENT )
    2817                 :          0 :             nResId = STR_PRIVATETEXT;
    2818         [ #  # ]:          0 :         else if( pClipboard->eBufferType & TRNSFR_GRAPHIC )
    2819                 :          0 :             nResId = STR_PRIVATEGRAPHIC;
    2820         [ #  # ]:          0 :         else if( pClipboard->eBufferType == TRNSFR_OLE )
    2821                 :          0 :             nResId = STR_PRIVATEOLE;
    2822                 :            :         else
    2823                 :          0 :             nResId = 0;
    2824                 :            : 
    2825         [ #  # ]:          0 :         if( nResId )
    2826                 :            :             rToFill.AddClipbrdFormat( SOT_FORMATSTR_ID_EMBED_SOURCE,
    2827 [ #  # ][ #  # ]:          0 :                                         SW_RESSTR( nResId ) );
    2828                 :            :     }
    2829                 :            :     else
    2830                 :            :     {
    2831         [ +  - ]:       2785 :         TransferableObjectDescriptor aDesc;
    2832 [ +  - ][ -  + ]:       2785 :         if( rData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
    2833                 :            :             ((TransferableDataHelper&)rData).GetTransferableObjectDescriptor(
    2834         [ #  # ]:          0 :                                 SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc );
    2835                 :            : 
    2836 [ +  - ][ -  + ]:       2785 :         if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_EMBED_SOURCE, nDest ))
    2837                 :            :             rToFill.AddClipbrdFormat( SOT_FORMATSTR_ID_EMBED_SOURCE,
    2838 [ #  # ][ #  # ]:          0 :                                             aDesc.maTypeName );
    2839 [ +  - ][ -  + ]:       2785 :         if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_LINK_SOURCE, nDest ))
    2840         [ #  # ]:          0 :             rToFill.AddClipbrdFormat( SOT_FORMATSTR_ID_LINK_SOURCE );
    2841                 :            : 
    2842                 :            :         SotFormatStringId nFormat;
    2843 [ +  - ][ +  - ]:       2785 :         if ( rData.HasFormat(nFormat = SOT_FORMATSTR_ID_EMBED_SOURCE_OLE) || rData.HasFormat(nFormat = SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE) )
         [ +  - ][ -  + ]
                 [ -  + ]
    2844                 :            :         {
    2845 [ #  # ][ #  # ]:          0 :             String sName,sSource;
    2846 [ #  # ][ #  # ]:          0 :             if ( SvPasteObjectHelper::GetEmbeddedName(rData,sName,sSource,nFormat) )
    2847 [ #  # ][ #  # ]:          0 :                 rToFill.AddClipbrdFormat( nFormat, sName );
         [ #  # ][ #  # ]
    2848         [ +  - ]:       2785 :         }
    2849                 :            :     }
    2850                 :            : 
    2851         [ -  + ]:       2785 :     if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_LINK, nDest ))
    2852 [ #  # ][ #  # ]:          0 :         rToFill.AddClipbrdFormat( SOT_FORMATSTR_ID_LINK, SW_RESSTR(STR_DDEFORMAT) );
    2853                 :            : 
    2854         [ +  + ]:      38990 :     for( sal_uInt16* pIds = aPasteSpecialIds; *pIds; ++pIds )
    2855         [ -  + ]:      36205 :         if( SwTransferable::_TestAllowedFormat( rData, *pIds, nDest ))
    2856         [ #  # ]:          0 :             rToFill.AddClipbrdFormat( *pIds, aEmptyStr );
    2857                 :       2785 : }
    2858                 :            : 
    2859                 :          0 : void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos )
    2860                 :            : {
    2861         [ #  # ]:          0 :     if(!pWrtShell)
    2862                 :          0 :         return;
    2863         [ #  # ]:          0 :     String sGrfNm;
    2864         [ #  # ]:          0 :     const int nSelection = pWrtShell->GetSelectionType();
    2865         [ #  # ]:          0 :     if( nsSelectionType::SEL_GRF == nSelection)
    2866                 :            :     {
    2867         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_SVXB );
    2868         [ #  # ]:          0 :         const Graphic* pGrf = pWrtShell->GetGraphic();
    2869 [ #  # ][ #  # ]:          0 :         if ( pGrf && pGrf->IsSupportedGraphic() )
         [ #  # ][ #  # ]
    2870                 :            :         {
    2871         [ #  # ]:          0 :             AddFormat( FORMAT_GDIMETAFILE );
    2872         [ #  # ]:          0 :             AddFormat( FORMAT_BITMAP );
    2873                 :            :         }
    2874                 :          0 :         eBufferType = TRNSFR_GRAPHIC;
    2875         [ #  # ]:          0 :         pWrtShell->GetGrfNms( &sGrfNm, 0 );
    2876                 :            :     }
    2877         [ #  # ]:          0 :     else if( nsSelectionType::SEL_OLE == nSelection )
    2878                 :            :     {
    2879         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
    2880         [ #  # ]:          0 :         PrepareOLE( aObjDesc );
    2881         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
    2882         [ #  # ]:          0 :         AddFormat( FORMAT_GDIMETAFILE );
    2883                 :          0 :         eBufferType = TRNSFR_OLE;
    2884                 :            :     }
    2885                 :            :     //Is there anything to provide anyway?
    2886 [ #  # ][ #  # ]:          0 :     else if ( pWrtShell->IsSelection() || pWrtShell->IsFrmSelected() ||
         [ #  # ][ #  # ]
                 [ #  # ]
    2887         [ #  # ]:          0 :               pWrtShell->IsObjSelected() )
    2888                 :            :     {
    2889 [ #  # ][ #  # ]:          0 :         if( pWrtShell->IsObjSelected() )
    2890                 :          0 :             eBufferType = TRNSFR_DRAWING;
    2891                 :            :         else
    2892                 :            :         {
    2893                 :          0 :             eBufferType = TRNSFR_DOCUMENT;
    2894         [ #  # ]:          0 :             if( SwWrtShell::NO_WORD !=
    2895         [ #  # ]:          0 :                 pWrtShell->IntelligentCut( nSelection, sal_False ))
    2896                 :            :                 eBufferType = TransferBufferType( TRNSFR_DOCUMENT_WORD
    2897                 :          0 :                                                     | eBufferType);
    2898                 :            :         }
    2899                 :            : 
    2900         [ #  # ]:          0 :         if( nSelection & nsSelectionType::SEL_TBL_CELLS )
    2901                 :          0 :             eBufferType = (TransferBufferType)(TRNSFR_TABELLE | eBufferType);
    2902                 :            : 
    2903         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
    2904                 :            : 
    2905                 :            :         //put RTF ahead of the OLE's Metafile for less loss
    2906 [ #  # ][ #  # ]:          0 :         if( !pWrtShell->IsObjSelected() )
    2907                 :            :         {
    2908         [ #  # ]:          0 :             AddFormat( FORMAT_RTF );
    2909         [ #  # ]:          0 :             AddFormat( SOT_FORMATSTR_ID_HTML );
    2910                 :            :         }
    2911         [ #  # ]:          0 :         if( pWrtShell->IsSelection() )
    2912         [ #  # ]:          0 :             AddFormat( FORMAT_STRING );
    2913                 :            : 
    2914         [ #  # ]:          0 :         if( nSelection & ( nsSelectionType::SEL_DRW | nsSelectionType::SEL_DRW_FORM ))
    2915                 :            :         {
    2916         [ #  # ]:          0 :             AddFormat( SOT_FORMATSTR_ID_DRAWING );
    2917         [ #  # ]:          0 :             if ( nSelection & nsSelectionType::SEL_DRW )
    2918                 :            :             {
    2919         [ #  # ]:          0 :                 AddFormat( FORMAT_GDIMETAFILE );
    2920         [ #  # ]:          0 :                 AddFormat( FORMAT_BITMAP );
    2921                 :            :             }
    2922                 :          0 :             eBufferType = (TransferBufferType)( TRNSFR_GRAPHIC | eBufferType );
    2923                 :            : 
    2924 [ #  # ][ #  # ]:          0 :             pClpGraphic = new Graphic;
    2925 [ #  # ][ #  # ]:          0 :             if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic ))
    2926                 :          0 :                 pOrigGrf = pClpGraphic;
    2927 [ #  # ][ #  # ]:          0 :             pClpBitmap = new Graphic;
    2928 [ #  # ][ #  # ]:          0 :             if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap ))
    2929                 :          0 :                 pOrigGrf = pClpBitmap;
    2930                 :            : 
    2931                 :            :             // is it an URL-Button ?
    2932 [ #  # ][ #  # ]:          0 :             String sURL, sDesc;
    2933 [ #  # ][ #  # ]:          0 :             if( pWrtShell->GetURLFromButton( sURL, sDesc ) )
    2934                 :            :             {
    2935         [ #  # ]:          0 :                 AddFormat( FORMAT_STRING );
    2936         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_SOLK );
    2937         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
    2938         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_FILECONTENT );
    2939         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR );
    2940         [ #  # ]:          0 :                  AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR );
    2941                 :          0 :                 eBufferType = (TransferBufferType)( TRNSFR_INETFLD | eBufferType );
    2942 [ #  # ][ #  # ]:          0 :             }
    2943                 :            :         }
    2944                 :            : 
    2945                 :            :         //ObjectDescriptor was already filled from the old DocShell.
    2946                 :            :         //Now adjust it. Thus in GetData the first query can still
    2947                 :            :         //be answered with delayed rendering.
    2948                 :          0 :         aObjDesc.mbCanLink = sal_False;
    2949                 :          0 :         aObjDesc.maDragStartPos = rSttPos;
    2950                 :            :         aObjDesc.maSize = OutputDevice::LogicToLogic( Size( OLESIZE ),
    2951 [ #  # ][ #  # ]:          0 :                                                 MAP_TWIP, MAP_100TH_MM );
         [ #  # ][ #  # ]
                 [ #  # ]
    2952         [ #  # ]:          0 :         PrepareOLE( aObjDesc );
    2953         [ #  # ]:          0 :         AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
    2954                 :            :     }
    2955 [ #  # ][ #  # ]:          0 :     else if( nSelection & nsSelectionType::SEL_TXT && !pWrtShell->HasMark() )
                 [ #  # ]
    2956                 :            :     {
    2957                 :            :         // is only one field - selected?
    2958         [ #  # ]:          0 :         SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR );
    2959                 :          0 :         Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY());
    2960                 :            : 
    2961 [ #  # ][ #  # ]:          0 :         if( pWrtShell->GetContentAtPos( aPos, aCntntAtPos ) )
    2962                 :            :         {
    2963         [ #  # ]:          0 :             AddFormat( FORMAT_STRING );
    2964         [ #  # ]:          0 :              AddFormat( SOT_FORMATSTR_ID_SOLK );
    2965         [ #  # ]:          0 :              AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
    2966         [ #  # ]:          0 :              AddFormat( SOT_FORMATSTR_ID_FILECONTENT );
    2967         [ #  # ]:          0 :              AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR );
    2968         [ #  # ]:          0 :              AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR );
    2969                 :          0 :             eBufferType = TRNSFR_INETFLD;
    2970         [ #  # ]:          0 :         }
    2971                 :            :     }
    2972                 :            : 
    2973 [ #  # ][ #  # ]:          0 :     if( pWrtShell->IsFrmSelected() )
    2974                 :            :     {
    2975 [ #  # ][ #  # ]:          0 :         SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_URL, RES_URL );
    2976         [ #  # ]:          0 :         pWrtShell->GetFlyFrmAttr( aSet );
    2977         [ #  # ]:          0 :         const SwFmtURL& rURL = (SwFmtURL&)aSet.Get( RES_URL );
    2978         [ #  # ]:          0 :         if( rURL.GetMap() )
    2979                 :            :         {
    2980 [ #  # ][ #  # ]:          0 :             pImageMap = new ImageMap( *rURL.GetMap() );
    2981         [ #  # ]:          0 :             AddFormat( SOT_FORMATSTR_ID_SVIM );
    2982                 :            :         }
    2983         [ #  # ]:          0 :         else if( rURL.GetURL().Len() )
    2984                 :            :         {
    2985                 :            :             pTargetURL = new INetImage( sGrfNm, rURL.GetURL(),
    2986                 :            :                                         rURL.GetTargetFrameName(),
    2987 [ #  # ][ #  # ]:          0 :                                         aEmptyStr, Size() );
    2988         [ #  # ]:          0 :             AddFormat( SOT_FORMATSTR_ID_INET_IMAGE );
    2989         [ #  # ]:          0 :         }
    2990         [ #  # ]:          0 :     }
    2991                 :            : }
    2992                 :            : 
    2993                 :          0 : void SwTransferable::StartDrag( Window* pWin, const Point& rPos )
    2994                 :            : {
    2995         [ #  # ]:          0 :     if(!pWrtShell)
    2996                 :          0 :         return;
    2997                 :          0 :     bOldIdle = pWrtShell->GetViewOptions()->IsIdle();
    2998                 :          0 :     bCleanUp = sal_True;
    2999                 :            : 
    3000                 :          0 :     ((SwViewOption *)pWrtShell->GetViewOptions())->SetIdle( sal_False );
    3001                 :            : 
    3002         [ #  # ]:          0 :     if( pWrtShell->IsSelFrmMode() )
    3003                 :          0 :         pWrtShell->ShowCrsr();
    3004                 :            : 
    3005                 :          0 :     SW_MOD()->pDragDrop = this;
    3006                 :            : 
    3007                 :          0 :     SetDataForDragAndDrop( rPos );
    3008                 :            : 
    3009                 :          0 :     sal_Int8 nDragOptions = DND_ACTION_COPYMOVE | DND_ACTION_LINK;
    3010                 :          0 :     SwDocShell* pDShell = pWrtShell->GetView().GetDocShell();
    3011 [ #  # ][ #  # ]:          0 :     if( ( pDShell && pDShell->IsReadOnly() ) || pWrtShell->HasReadonlySel() )
         [ #  # ][ #  # ]
    3012                 :          0 :         nDragOptions &= ~DND_ACTION_MOVE;
    3013                 :            : 
    3014                 :          0 :     TransferableHelper::StartDrag( pWin, nDragOptions );
    3015                 :            : }
    3016                 :            : 
    3017                 :          0 : void SwTransferable::DragFinished( sal_Int8 nAction )
    3018                 :            : {
    3019                 :            :     //And the last finishing work so that all statuses are right
    3020         [ #  # ]:          0 :     if( DND_ACTION_MOVE == nAction  )
    3021                 :            :     {
    3022         [ #  # ]:          0 :         if( bCleanUp )
    3023                 :            :         {
    3024                 :            :             //It was dropped outside of Writer. We still have to
    3025                 :            :             //delete.
    3026                 :            : 
    3027                 :          0 :             pWrtShell->StartAllAction();
    3028                 :          0 :             pWrtShell->StartUndo( UNDO_UI_DRAG_AND_MOVE );
    3029         [ #  # ]:          0 :             if ( pWrtShell->IsTableMode() )
    3030                 :          0 :                 pWrtShell->DeleteTblSel();
    3031                 :            :             else
    3032                 :            :             {
    3033 [ #  # ][ #  # ]:          0 :                 if ( !(pWrtShell->IsSelFrmMode() || pWrtShell->IsObjSelected()) )
                 [ #  # ]
    3034                 :            :                     //SmartCut, take one of the blanks along
    3035                 :          0 :                     pWrtShell->IntelligentCut( pWrtShell->GetSelectionType(), sal_True );
    3036                 :          0 :                 pWrtShell->DelRight();
    3037                 :            :             }
    3038                 :          0 :             pWrtShell->EndUndo( UNDO_UI_DRAG_AND_MOVE );
    3039                 :          0 :             pWrtShell->EndAllAction();
    3040                 :            :         }
    3041                 :            :         else
    3042                 :            :         {
    3043                 :          0 :             const int nSelection = pWrtShell->GetSelectionType();
    3044         [ #  # ]:          0 :             if( ( nsSelectionType::SEL_FRM | nsSelectionType::SEL_GRF |
    3045                 :            :                  nsSelectionType::SEL_OLE | nsSelectionType::SEL_DRW ) & nSelection )
    3046                 :            :             {
    3047                 :          0 :                 pWrtShell->EnterSelFrmMode();
    3048                 :            :             }
    3049                 :            :         }
    3050                 :            :     }
    3051                 :          0 :     pWrtShell->GetView().GetEditWin().DragFinished();
    3052                 :            : 
    3053         [ #  # ]:          0 :     if( pWrtShell->IsSelFrmMode() )
    3054                 :          0 :         pWrtShell->HideCrsr();
    3055                 :            :     else
    3056                 :          0 :         pWrtShell->ShowCrsr();
    3057                 :            : 
    3058                 :          0 :     ((SwViewOption *)pWrtShell->GetViewOptions())->SetIdle( bOldIdle );
    3059                 :          0 : }
    3060                 :            : 
    3061                 :          0 : int SwTransferable::PrivatePaste( SwWrtShell& rShell )
    3062                 :            : {
    3063                 :            :     // first, ask for the SelectionType, then action-bracketing !!!!
    3064                 :            :     // (otherwise it's not pasted into a TableSelection!!!)
    3065                 :            :     OSL_ENSURE( !rShell.ActionPend(), "Paste darf nie eine Actionklammerung haben" );
    3066         [ #  # ]:          0 :     if ( !pClpDocFac )
    3067                 :          0 :         return sal_False; // the return value of the SwFEShell::Paste also is sal_Bool!
    3068                 :            : 
    3069         [ #  # ]:          0 :     const int nSelection = rShell.GetSelectionType();
    3070                 :            : 
    3071         [ #  # ]:          0 :     SwRewriter aRewriter;
    3072                 :            : 
    3073         [ #  # ]:          0 :     SwTrnsfrActionAndUndo aAction( &rShell, UNDO_PASTE_CLIPBOARD);
    3074                 :            : 
    3075                 :          0 :     bool bKillPaMs = false;
    3076                 :            : 
    3077                 :            :     //Delete selected content, not at table-selection and table in Clipboard
    3078 [ #  # ][ #  # ]:          0 :     if( rShell.HasSelection() && !( nSelection & nsSelectionType::SEL_TBL_CELLS))
         [ #  # ][ #  # ]
    3079                 :            :     {
    3080                 :          0 :         bKillPaMs = true;
    3081                 :          0 :         rShell.SetRetainSelection( true );
    3082         [ #  # ]:          0 :         rShell.DelRight();
    3083                 :            :         // when a Fly was selected, a valid cursor position has to be found now
    3084                 :            :         // (parked Cursor!)
    3085         [ #  # ]:          0 :         if( ( nsSelectionType::SEL_FRM | nsSelectionType::SEL_GRF |
    3086                 :            :             nsSelectionType::SEL_OLE | nsSelectionType::SEL_DRW |
    3087                 :            :             nsSelectionType::SEL_DRW_FORM ) & nSelection )
    3088                 :            :         {
    3089                 :            :             // position the cursor again
    3090                 :          0 :             Point aPt( rShell.GetCharRect().Pos() );
    3091         [ #  # ]:          0 :             rShell.SwCrsrShell::SetCrsr( aPt, sal_True );
    3092                 :            :         }
    3093                 :          0 :         rShell.SetRetainSelection( false );
    3094                 :            :     }
    3095                 :            : 
    3096                 :          0 :     sal_Bool bInWrd = sal_False, bEndWrd = sal_False, bSttWrd = sal_False,
    3097                 :          0 :          bSmart = 0 != (TRNSFR_DOCUMENT_WORD & eBufferType);
    3098         [ #  # ]:          0 :     if( bSmart )
    3099                 :            :     {
    3100                 :            : // Why not for other Scripts? If TRNSFR_DOCUMENT_WORD is set, we have a word
    3101                 :            : // in the buffer, word in this context means 'something with spaces at beginning
    3102                 :            : // and end'. In this case we definitely want these spaces to be inserted here.
    3103         [ #  # ]:          0 :             bInWrd = rShell.IsInWrd();
    3104         [ #  # ]:          0 :              bEndWrd = rShell.IsEndWrd();
    3105 [ #  # ][ #  # ]:          0 :             bSmart = bInWrd || bEndWrd;
    3106         [ #  # ]:          0 :             if( bSmart )
    3107                 :            :             {
    3108         [ #  # ]:          0 :                  bSttWrd = rShell.IsSttWrd();
    3109 [ #  # ][ #  # ]:          0 :                 if( bSmart && !bSttWrd && (bInWrd || bEndWrd) )
         [ #  # ][ #  # ]
    3110         [ #  # ]:          0 :                     rShell.SwEditShell::Insert(' ');
    3111                 :            :             }
    3112                 :            :     }
    3113                 :            : 
    3114 [ #  # ][ #  # ]:          0 :     int nRet = rShell.Paste( pClpDocFac->GetDoc() );
    3115                 :            : 
    3116         [ #  # ]:          0 :     if( bKillPaMs )
    3117         [ #  # ]:          0 :         rShell.KillPams();
    3118                 :            : 
    3119                 :            :     // If Smart Paste then insert blank
    3120 [ #  # ][ #  # ]:          0 :     if( nRet && bSmart && ((bInWrd && !bEndWrd )|| bSttWrd) )
         [ #  # ][ #  # ]
                 [ #  # ]
    3121         [ #  # ]:          0 :         rShell.SwEditShell::Insert(' ');
    3122                 :            : 
    3123 [ #  # ][ #  # ]:          0 :     return nRet;
    3124                 :            : }
    3125                 :            : 
    3126                 :          0 : int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt,
    3127                 :            :                                 sal_Bool bMove, sal_Bool bIsXSelection )
    3128                 :            : {
    3129                 :          0 :     int cWord    = 0;
    3130                 :          0 :     sal_Bool bInWrd  = sal_False;
    3131                 :          0 :     sal_Bool bEndWrd = sal_False;
    3132                 :          0 :     sal_Bool bSttWrd = sal_False;
    3133                 :          0 :     sal_Bool bSttPara= sal_False;
    3134                 :          0 :     sal_Bool bTblSel = sal_False;
    3135                 :          0 :     sal_Bool bFrmSel = sal_False;
    3136                 :            : 
    3137                 :          0 :     SwWrtShell& rSrcSh = *GetShell();
    3138                 :            : 
    3139         [ #  # ]:          0 :     rSh.UnSetVisCrsr();
    3140                 :            : 
    3141         [ #  # ]:          0 :     if( TRNSFR_INETFLD == eBufferType )
    3142                 :            :     {
    3143 [ #  # ][ #  # ]:          0 :         if( rSh.GetFmtFromObj( rDragPt ) )
    3144                 :            :         {
    3145         [ #  # ]:          0 :             INetBookmark aTmp;
    3146 [ #  # ][ #  # ]:          0 :             if( (TRNSFR_INETFLD & eBufferType) && pBkmk )
    3147         [ #  # ]:          0 :                 aTmp = *pBkmk;
    3148                 :            : 
    3149                 :            :             // select target graphic
    3150 [ #  # ][ #  # ]:          0 :             if( rSh.SelectObj( rDragPt ) )
    3151                 :            :             {
    3152         [ #  # ]:          0 :                 rSh.HideCrsr();
    3153         [ #  # ]:          0 :                 rSh.EnterSelFrmMode( &rDragPt );
    3154                 :          0 :                 bFrmDrag = sal_True;
    3155                 :            :             }
    3156                 :            : 
    3157         [ #  # ]:          0 :             const int nSelection = rSh.GetSelectionType();
    3158                 :            : 
    3159                 :            :             // not yet consider Draw objects
    3160         [ #  # ]:          0 :             if( nsSelectionType::SEL_GRF & nSelection )
    3161                 :            :             {
    3162 [ #  # ][ #  # ]:          0 :                 SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
    3163         [ #  # ]:          0 :                 rSh.GetFlyFrmAttr( aSet );
    3164 [ #  # ][ #  # ]:          0 :                 SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
    3165         [ #  # ]:          0 :                 aURL.SetURL( aTmp.GetURL(), sal_False );
    3166         [ #  # ]:          0 :                 aSet.Put( aURL );
    3167         [ #  # ]:          0 :                 rSh.SetFlyFrmAttr( aSet );
    3168 [ #  # ][ #  # ]:          0 :                 return 1;
    3169                 :            :             }
    3170                 :            : 
    3171         [ #  # ]:          0 :             if( nsSelectionType::SEL_DRW & nSelection )
    3172                 :            :             {
    3173         [ #  # ]:          0 :                 rSh.LeaveSelFrmMode();
    3174         [ #  # ]:          0 :                 rSh.UnSelectFrm();
    3175         [ #  # ]:          0 :                 rSh.ShowCrsr();
    3176                 :          0 :                 bFrmDrag = sal_False;
    3177 [ #  # ][ #  # ]:          0 :             }
    3178                 :            :         }
    3179                 :            :     }
    3180                 :            : 
    3181 [ #  # ][ #  # ]:          0 :     if( &rSh != &rSrcSh && (nsSelectionType::SEL_GRF & rSh.GetSelectionType()) &&
         [ #  # ][ #  # ]
                 [ #  # ]
    3182                 :            :         TRNSFR_GRAPHIC == eBufferType )
    3183                 :            :     {
    3184                 :            :         // ReRead the graphic
    3185 [ #  # ][ #  # ]:          0 :         String sGrfNm, sFltNm;
    3186         [ #  # ]:          0 :         rSrcSh.GetGrfNms( &sGrfNm, &sFltNm );
    3187 [ #  # ][ #  # ]:          0 :         rSh.ReRead( sGrfNm, sFltNm, rSrcSh.GetGraphic() );
    3188 [ #  # ][ #  # ]:          0 :         return 1;
    3189                 :            :     }
    3190                 :            : 
    3191                 :            :     //not in selections or selected frames
    3192         [ #  # ]:          0 :     if( rSh.ChgCurrPam( rDragPt ) ||
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    3193         [ #  # ]:          0 :         ( rSh.IsSelFrmMode() && rSh.IsInsideSelectedObj( rDragPt )) )
    3194                 :          0 :         return 0;
    3195                 :            : 
    3196         [ #  # ]:          0 :     if( rSrcSh.IsTableMode() )
    3197                 :          0 :         bTblSel = sal_True;
    3198 [ #  # ][ #  # ]:          0 :     else if( rSrcSh.IsSelFrmMode() || rSrcSh.IsObjSelected() )
         [ #  # ][ #  # ]
    3199                 :            :     {
    3200                 :            :         // don't move position-protected objects!
    3201 [ #  # ][ #  # ]:          0 :         if( bMove && rSrcSh.IsSelObjProtected( FLYPROTECT_POS ) )
         [ #  # ][ #  # ]
    3202                 :          0 :             return 0;
    3203                 :            : 
    3204                 :          0 :         bFrmSel = sal_True;
    3205                 :            :     }
    3206                 :            : 
    3207         [ #  # ]:          0 :     const int nSel = rSrcSh.GetSelectionType();
    3208                 :            : 
    3209         [ #  # ]:          0 :     SwUndoId eUndoId = bMove ? UNDO_UI_DRAG_AND_MOVE : UNDO_UI_DRAG_AND_COPY;
    3210                 :            : 
    3211         [ #  # ]:          0 :     SwRewriter aRewriter;
    3212                 :            : 
    3213 [ #  # ][ #  # ]:          0 :     aRewriter.AddRule(UndoArg1, rSrcSh.GetSelDescr());
                 [ #  # ]
    3214                 :            : 
    3215         [ #  # ]:          0 :     if(rSrcSh.GetDoc() != rSh.GetDoc())
    3216         [ #  # ]:          0 :         rSrcSh.StartUndo( eUndoId, &aRewriter );
    3217         [ #  # ]:          0 :     rSh.StartUndo( eUndoId, &aRewriter );
    3218                 :            : 
    3219         [ #  # ]:          0 :     rSh.StartAction();
    3220         [ #  # ]:          0 :     rSrcSh.StartAction();
    3221                 :            : 
    3222         [ #  # ]:          0 :     if( &rSrcSh != &rSh )
    3223                 :            :     {
    3224         [ #  # ]:          0 :         rSh.EnterStdMode();
    3225         [ #  # ]:          0 :         rSh.SwCrsrShell::SetCrsr( rDragPt, sal_True );
    3226         [ #  # ]:          0 :         cWord = rSrcSh.IntelligentCut( nSel, sal_False );
    3227                 :            :     }
    3228 [ #  # ][ #  # ]:          0 :     else if( !bTblSel && !bFrmSel )
    3229                 :            :     {
    3230         [ #  # ]:          0 :         if( !rSh.IsAddMode() )
    3231                 :            :         {
    3232                 :            :             // #i87233#
    3233         [ #  # ]:          0 :             if ( rSh.IsBlockMode() )
    3234                 :            :             {
    3235                 :            :                 // preserve order of cursors for block mode
    3236         [ #  # ]:          0 :                 rSh.GoPrevCrsr();
    3237                 :            :             }
    3238                 :            : 
    3239         [ #  # ]:          0 :             rSh.SwCrsrShell::CreateCrsr();
    3240                 :            :         }
    3241         [ #  # ]:          0 :         rSh.SwCrsrShell::SetCrsr( rDragPt, sal_True, false );
    3242         [ #  # ]:          0 :         rSh.GoPrevCrsr();
    3243 [ #  # ][ #  # ]:          0 :         cWord = rSh.IntelligentCut( rSh.GetSelectionType(), sal_False );
    3244         [ #  # ]:          0 :         rSh.GoNextCrsr();
    3245                 :            :     }
    3246                 :            : 
    3247         [ #  # ]:          0 :     bInWrd  = rSh.IsInWrd();
    3248         [ #  # ]:          0 :     bEndWrd = rSh.IsEndWrd();
    3249 [ #  # ][ #  # ]:          0 :     bSttWrd = !bEndWrd && rSh.IsSttWrd();
                 [ #  # ]
    3250         [ #  # ]:          0 :     bSttPara= rSh.IsSttPara();
    3251                 :            : 
    3252                 :          0 :     Point aSttPt( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY() );
    3253                 :            : 
    3254                 :            :     // at first, select INetFelder!
    3255         [ #  # ]:          0 :     if( TRNSFR_INETFLD == eBufferType )
    3256                 :            :     {
    3257         [ #  # ]:          0 :         if( &rSrcSh == &rSh )
    3258                 :            :         {
    3259         [ #  # ]:          0 :             rSh.GoPrevCrsr();
    3260         [ #  # ]:          0 :             rSh.SwCrsrShell::SetCrsr( aSttPt, sal_True );
    3261         [ #  # ]:          0 :             rSh.SelectTxtAttr( RES_TXTATR_INETFMT );
    3262 [ #  # ][ #  # ]:          0 :             if( rSh.ChgCurrPam( rDragPt ) )
    3263                 :            :             {
    3264                 :            :                 // don't copy/move inside of yourself
    3265         [ #  # ]:          0 :                 rSh.DestroyCrsr();
    3266         [ #  # ]:          0 :                 rSh.EndUndo();
    3267         [ #  # ]:          0 :                 rSh.EndAction();
    3268         [ #  # ]:          0 :                 rSh.EndAction();
    3269                 :          0 :                 return 0;
    3270                 :            :             }
    3271         [ #  # ]:          0 :             rSh.GoNextCrsr();
    3272                 :            :         }
    3273                 :            :         else
    3274                 :            :         {
    3275         [ #  # ]:          0 :             rSrcSh.SwCrsrShell::SetCrsr( aSttPt, sal_True );
    3276         [ #  # ]:          0 :             rSrcSh.SelectTxtAttr( RES_TXTATR_INETFMT );
    3277                 :            :         }
    3278                 :            : 
    3279                 :            :         // is there an URL attribute at the insert point? Then replace that,
    3280                 :            :         // so simply put up a selection?
    3281         [ #  # ]:          0 :         rSh.DelINetAttrWithText();
    3282                 :          0 :         bDDINetAttr = sal_True;
    3283                 :            :     }
    3284                 :            : 
    3285         [ #  # ]:          0 :     if ( rSrcSh.IsSelFrmMode() )
    3286                 :            :     {
    3287                 :            :         //Hack: fool the special treatment
    3288         [ #  # ]:          0 :         aSttPt -= aSttPt - rSrcSh.GetObjRect().Pos();
    3289                 :            :     }
    3290                 :            : 
    3291                 :            :     sal_Bool bRet = rSrcSh.SwFEShell::Copy( &rSh, aSttPt, rDragPt, bMove,
    3292         [ #  # ]:          0 :                                             !bIsXSelection );
    3293                 :            : 
    3294         [ #  # ]:          0 :     if( !bIsXSelection )
    3295                 :            :     {
    3296         [ #  # ]:          0 :         rSrcSh.Push();
    3297 [ #  # ][ #  # ]:          0 :         if ( bRet && bMove && !bFrmSel )
                 [ #  # ]
    3298                 :            :         {
    3299         [ #  # ]:          0 :             if ( bTblSel )
    3300                 :            :             {
    3301                 :            :                 /* delete table contents not cells */
    3302         [ #  # ]:          0 :                 rSrcSh.Delete();
    3303                 :            :             }
    3304                 :            :             else
    3305                 :            :             {
    3306                 :            :                 //SmartCut, take one of the blanks along.
    3307         [ #  # ]:          0 :                 rSh.SwCrsrShell::DestroyCrsr();
    3308         [ #  # ]:          0 :                 if ( cWord == SwWrtShell::WORD_SPACE_BEFORE )
    3309         [ #  # ]:          0 :                     rSh.ExtendSelection( sal_False );
    3310         [ #  # ]:          0 :                 else if ( cWord == SwWrtShell::WORD_SPACE_AFTER )
    3311         [ #  # ]:          0 :                     rSh.ExtendSelection();
    3312         [ #  # ]:          0 :                 rSrcSh.DelRight();
    3313                 :            :             }
    3314                 :            :         }
    3315         [ #  # ]:          0 :         rSrcSh.KillPams();
    3316         [ #  # ]:          0 :         rSrcSh.Pop( sal_False );
    3317                 :            : 
    3318                 :            :         /* after dragging a table selection inside one shell
    3319                 :            :             set cursor to the drop position. */
    3320 [ #  # ][ #  # ]:          0 :         if( &rSh == &rSrcSh && ( bTblSel || rSh.IsBlockMode() ) )
         [ #  # ][ #  # ]
    3321                 :            :         {
    3322         [ #  # ]:          0 :             rSrcSh.SwCrsrShell::SetCrsr(rDragPt);
    3323 [ #  # ][ #  # ]:          0 :             rSrcSh.GetSwCrsr()->SetMark();
    3324                 :            :         }
    3325                 :            :     }
    3326                 :            : 
    3327 [ #  # ][ #  # ]:          0 :     if( bRet && !bTblSel && !bFrmSel )
                 [ #  # ]
    3328                 :            :     {
    3329 [ #  # ][ #  # ]:          0 :         if( (bInWrd || bEndWrd) &&
         [ #  # ][ #  # ]
    3330                 :            :             (cWord == SwWrtShell::WORD_SPACE_AFTER ||
    3331                 :            :                 cWord == SwWrtShell::WORD_SPACE_BEFORE) )
    3332                 :            :         {
    3333 [ #  # ][ #  # ]:          0 :             if ( bSttWrd || (bInWrd && !bEndWrd))
                 [ #  # ]
    3334         [ #  # ]:          0 :                 rSh.SwEditShell::Insert(' ', bIsXSelection);
    3335 [ #  # ][ #  # ]:          0 :             if ( !bSttWrd || (bInWrd && !bSttPara) )
                 [ #  # ]
    3336                 :            :             {
    3337         [ #  # ]:          0 :                 rSh.SwapPam();
    3338         [ #  # ]:          0 :                 if ( !bSttWrd )
    3339         [ #  # ]:          0 :                     rSh.SwEditShell::Insert(' ', bIsXSelection);
    3340         [ #  # ]:          0 :                 rSh.SwapPam();
    3341                 :            :             }
    3342                 :            :         }
    3343                 :            : 
    3344         [ #  # ]:          0 :         if( bIsXSelection )
    3345                 :            :         {
    3346 [ #  # ][ #  # ]:          0 :             if( &rSrcSh == &rSh && !rSh.IsAddMode() )
                 [ #  # ]
    3347                 :            :             {
    3348         [ #  # ]:          0 :                 rSh.SwCrsrShell::DestroyCrsr();
    3349         [ #  # ]:          0 :                 rSh.GoPrevCrsr();
    3350                 :            :             }
    3351                 :            :             else
    3352                 :            :             {
    3353         [ #  # ]:          0 :                 rSh.SwapPam();
    3354         [ #  # ]:          0 :                 rSh.SwCrsrShell::ClearMark();
    3355                 :            :             }
    3356                 :            :         }
    3357                 :            :         else
    3358                 :            :         {
    3359         [ #  # ]:          0 :             if( rSh.IsAddMode() )
    3360         [ #  # ]:          0 :                 rSh.SwCrsrShell::CreateCrsr();
    3361                 :            :             else
    3362                 :            :             {
    3363                 :            :                 // turn on selection mode
    3364         [ #  # ]:          0 :                 rSh.SttSelect();
    3365         [ #  # ]:          0 :                 rSh.EndSelect();
    3366                 :            :             }
    3367                 :            :         }
    3368                 :            :     }
    3369                 :            : 
    3370 [ #  # ][ #  # ]:          0 :     if( bRet && bMove && bFrmSel )
                 [ #  # ]
    3371         [ #  # ]:          0 :         rSrcSh.LeaveSelFrmMode();
    3372                 :            : 
    3373         [ #  # ]:          0 :     if( rSrcSh.GetDoc() != rSh.GetDoc() )
    3374         [ #  # ]:          0 :         rSrcSh.EndUndo();
    3375         [ #  # ]:          0 :     rSh.EndUndo();
    3376                 :            : 
    3377                 :            :         // put the shell in the right state
    3378 [ #  # ][ #  # ]:          0 :     if( &rSrcSh != &rSh && ( rSh.IsFrmSelected() || rSh.IsObjSelected() ))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    3379         [ #  # ]:          0 :         rSh.EnterSelFrmMode();
    3380                 :            : 
    3381         [ #  # ]:          0 :     rSrcSh.EndAction();
    3382         [ #  # ]:          0 :     rSh.EndAction();
    3383         [ #  # ]:          0 :     return 1;
    3384                 :            : }
    3385                 :            : 
    3386                 :            : // Interfaces for Selection
    3387                 :         20 : void SwTransferable::CreateSelection( SwWrtShell& rSh,
    3388                 :            :                                       const ViewShell * _pCreatorView )
    3389                 :            : {
    3390         [ +  - ]:         20 :     SwModule *pMod = SW_MOD();
    3391         [ +  - ]:         20 :     SwTransferable* pNew = new SwTransferable( rSh );
    3392                 :            : 
    3393                 :         20 :      pNew->pCreatorView = _pCreatorView;
    3394                 :            : 
    3395                 :            :     uno::Reference<
    3396 [ +  - ][ +  - ]:         20 :             datatransfer::XTransferable > xRef( pNew );
    3397                 :         20 :     pMod->pXSelection = pNew;
    3398         [ +  - ]:         20 :     pNew->CopyToSelection( rSh.GetWin() );
    3399                 :         20 : }
    3400                 :            : 
    3401                 :       1315 : void SwTransferable::ClearSelection( SwWrtShell& rSh,
    3402                 :            :                                      const ViewShell * _pCreatorView)
    3403                 :            : {
    3404                 :       1315 :     SwModule *pMod = SW_MOD();
    3405 [ +  + ][ +  - ]:       1315 :     if( pMod->pXSelection &&
         [ -  + ][ #  # ]
                 [ +  + ]
    3406                 :         20 :         ((!pMod->pXSelection->pWrtShell) || (pMod->pXSelection->pWrtShell == &rSh)) &&
    3407                 :            :         (!_pCreatorView || (pMod->pXSelection->pCreatorView == _pCreatorView)) )
    3408                 :            :     {
    3409                 :         20 :         TransferableHelper::ClearSelection( rSh.GetWin() );
    3410                 :            :     }
    3411                 :       1315 : }
    3412                 :            : 
    3413                 :            : namespace
    3414                 :            : {
    3415                 :            :     class theSwTransferableUnoTunnelId : public rtl::Static< UnoTunnelIdInit, SwTransferable > {};
    3416                 :            : }
    3417                 :            : 
    3418                 :          8 : const Sequence< sal_Int8 >& SwTransferable::getUnoTunnelId()
    3419                 :            : {
    3420                 :          8 :     return theSwTransferableUnoTunnelId::get().getSeq();
    3421                 :            : }
    3422                 :            : 
    3423                 :          4 : sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId ) throw( RuntimeException )
    3424                 :            : {
    3425                 :            :     sal_Int64 nRet;
    3426   [ +  -  +  - ]:          8 :     if( ( rId.getLength() == 16 ) &&
                 [ +  - ]
    3427                 :          4 :         ( 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
    3428                 :            :     {
    3429                 :          4 :         nRet = sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) );
    3430                 :            :     }
    3431                 :            :     else
    3432                 :          0 :         nRet = TransferableHelper::getSomething(rId);
    3433                 :          4 :     return nRet;
    3434                 :            : }
    3435                 :            : 
    3436                 :       2785 : SwTransferable* SwTransferable::GetSwTransferable( const TransferableDataHelper& rData )
    3437                 :            : {
    3438                 :       2785 :     SwTransferable* pSwTransferable = NULL;
    3439                 :            : 
    3440         [ +  - ]:       2785 :     uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY );
    3441         [ -  + ]:       2785 :     if ( xTunnel.is() )
    3442                 :            :     {
    3443 [ #  # ][ #  # ]:          0 :         sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() );
                 [ #  # ]
    3444         [ #  # ]:          0 :         if ( nHandle )
    3445                 :          0 :             pSwTransferable = (SwTransferable*) (sal_IntPtr) nHandle;
    3446                 :            :     }
    3447                 :            : 
    3448                 :       2785 :     return pSwTransferable;
    3449                 :            : 
    3450                 :            : }
    3451                 :            : 
    3452                 :          0 : SwTrnsfrDdeLink::SwTrnsfrDdeLink( SwTransferable& rTrans, SwWrtShell& rSh )
    3453                 :            :     : rTrnsfr( rTrans ), pDocShell( 0 ),
    3454         [ #  # ]:          0 :     bDelBookmrk( sal_False ), bInDisconnect( sal_False )
    3455                 :            : {
    3456                 :            :     // we only end up here with table- or text selection
    3457 [ #  # ][ #  # ]:          0 :     if( nsSelectionType::SEL_TBL_CELLS & rSh.GetSelectionType() )
    3458                 :            :     {
    3459         [ #  # ]:          0 :         SwFrmFmt* pFmt = rSh.GetTableFmt();
    3460         [ #  # ]:          0 :         if( pFmt )
    3461         [ #  # ]:          0 :             sName = pFmt->GetName();
    3462                 :            :     }
    3463                 :            :     else
    3464                 :            :     {
    3465                 :            :         // creating a temp. bookmark without undo
    3466         [ #  # ]:          0 :         sal_Bool bUndo = rSh.DoesUndo();
    3467         [ #  # ]:          0 :         rSh.DoUndo( sal_False );
    3468         [ #  # ]:          0 :         sal_Bool bIsModified = rSh.IsModified();
    3469                 :            : 
    3470                 :            :         ::sw::mark::IMark* pMark = rSh.SetBookmark(
    3471                 :            :             KeyCode(),
    3472                 :            :             ::rtl::OUString(),
    3473                 :            :             ::rtl::OUString(),
    3474         [ #  # ]:          0 :             IDocumentMarkAccess::DDE_BOOKMARK);
    3475         [ #  # ]:          0 :         if(pMark)
    3476                 :            :         {
    3477 [ #  # ][ #  # ]:          0 :             sName = pMark->GetName();
    3478                 :          0 :             bDelBookmrk = sal_True;
    3479         [ #  # ]:          0 :             if( !bIsModified )
    3480         [ #  # ]:          0 :                 rSh.ResetModified();
    3481                 :            :         }
    3482                 :            :         else
    3483         [ #  # ]:          0 :             sName.Erase();
    3484         [ #  # ]:          0 :         rSh.DoUndo( bUndo );
    3485                 :            :     }
    3486                 :            : 
    3487   [ #  #  #  # ]:          0 :     if( sName.Len() &&
                 [ #  # ]
    3488                 :          0 :         0 != ( pDocShell = rSh.GetDoc()->GetDocShell() ) )
    3489                 :            :     {
    3490                 :            :         // then we create our "server" and connect to it
    3491 [ #  # ][ #  # ]:          0 :         refObj = pDocShell->DdeCreateLinkSource( sName );
    3492         [ #  # ]:          0 :         if( refObj.Is() )
    3493                 :            :         {
    3494         [ #  # ]:          0 :             refObj->AddConnectAdvise( this );
    3495                 :            :             refObj->AddDataAdvise( this,
    3496                 :            :                             aEmptyStr,
    3497         [ #  # ]:          0 :                             ADVISEMODE_NODATA | ADVISEMODE_ONLYONCE );
    3498         [ #  # ]:          0 :             nOldTimeOut = refObj->GetUpdateTimeout();
    3499         [ #  # ]:          0 :             refObj->SetUpdateTimeout( 0 );
    3500                 :            :         }
    3501                 :            :     }
    3502                 :          0 : }
    3503                 :            : 
    3504 [ #  # ][ #  # ]:          0 : SwTrnsfrDdeLink::~SwTrnsfrDdeLink()
    3505                 :            : {
    3506         [ #  # ]:          0 :     if( refObj.Is() )
    3507         [ #  # ]:          0 :         Disconnect( sal_True );
    3508         [ #  # ]:          0 : }
    3509                 :            : 
    3510                 :          0 : ::sfx2::SvBaseLink::UpdateResult SwTrnsfrDdeLink::DataChanged( const String& ,
    3511                 :            :                                     const uno::Any& )
    3512                 :            : {
    3513                 :            :     // well, that's it with the link
    3514         [ #  # ]:          0 :     if( !bInDisconnect )
    3515                 :            :     {
    3516 [ #  # ][ #  # ]:          0 :         if( FindDocShell() && pDocShell->GetView() )
                 [ #  # ]
    3517                 :          0 :             rTrnsfr.RemoveDDELinkFormat( pDocShell->GetView()->GetEditWin() );
    3518                 :          0 :         Disconnect( sal_False );
    3519                 :            :     }
    3520                 :          0 :     return SUCCESS;
    3521                 :            : }
    3522                 :            : 
    3523                 :          0 : sal_Bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm )
    3524                 :            : {
    3525 [ #  # ][ #  # ]:          0 :     if( !refObj.Is() || !FindDocShell() )
         [ #  # ][ #  # ]
    3526                 :          0 :         return sal_False;
    3527                 :            : 
    3528         [ #  # ]:          0 :     rtl_TextEncoding eEncoding = DDE_TXT_ENCODING;
    3529                 :            :     const rtl::OString aAppNm(rtl::OUStringToOString(
    3530 [ #  # ][ #  # ]:          0 :         GetpApp()->GetAppName(), eEncoding));
         [ #  # ][ #  # ]
                 [ #  # ]
    3531                 :            :     const rtl::OString aTopic(rtl::OUStringToOString(
    3532 [ #  # ][ #  # ]:          0 :         pDocShell->GetTitle(SFX_TITLE_FULLNAME), eEncoding));
         [ #  # ][ #  # ]
    3533 [ #  # ][ #  # ]:          0 :     const rtl::OString aName(rtl::OUStringToOString(sName, eEncoding));
    3534                 :            : 
    3535         [ #  # ]:          0 :     sal_Char* pMem = new sal_Char[ aAppNm.getLength() + aTopic.getLength() + aName.getLength() + 4 ];
    3536                 :            : 
    3537                 :          0 :     sal_Int32 nLen = aAppNm.getLength();
    3538                 :          0 :     memcpy( pMem, aAppNm.getStr(), nLen );
    3539                 :          0 :     pMem[ nLen++ ] = 0;
    3540                 :          0 :     memcpy( pMem + nLen, aTopic.getStr(), aTopic.getLength() );
    3541                 :          0 :     nLen = nLen + aTopic.getLength();
    3542                 :          0 :     pMem[ nLen++ ] = 0;
    3543                 :          0 :     memcpy( pMem + nLen, aName.getStr(), aName.getLength() );
    3544                 :          0 :     nLen = nLen + aName.getLength();
    3545                 :          0 :     pMem[ nLen++ ] = 0;
    3546                 :          0 :     pMem[ nLen++ ] = 0;
    3547                 :            : 
    3548         [ #  # ]:          0 :     rStrm.Write( pMem, nLen );
    3549         [ #  # ]:          0 :     delete[] pMem;
    3550                 :            : 
    3551         [ #  # ]:          0 :     IDocumentMarkAccess* const pMarkAccess = pDocShell->GetDoc()->getIDocumentMarkAccess();
    3552 [ #  # ][ #  # ]:          0 :     IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(sName);
    3553 [ #  # ][ #  # ]:          0 :     if(ppMark != pMarkAccess->getMarksEnd()
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
    3554         [ #  # ]:          0 :         && IDocumentMarkAccess::GetType(**ppMark) != IDocumentMarkAccess::BOOKMARK)
    3555                 :            :     {
    3556                 :            :         // the mark is still a DdeBookmark
    3557                 :            :         // we replace it with a Bookmark, so it will get saved etc.
    3558                 :          0 :         ::sw::mark::IMark* const pMark = ppMark->get();
    3559         [ #  # ]:          0 :         SwServerObject* const pServerObject = dynamic_cast<SwServerObject *>(&refObj);
    3560                 :            : 
    3561                 :            :         // collecting state of old mark
    3562 [ #  # ][ #  # ]:          0 :         SwPaM aPaM(pMark->GetMarkStart());
    3563 [ #  # ][ #  # ]:          0 :         *aPaM.GetPoint() = pMark->GetMarkStart();
    3564 [ #  # ][ #  # ]:          0 :         if(pMark->IsExpanded())
    3565                 :            :         {
    3566         [ #  # ]:          0 :             aPaM.SetMark();
    3567 [ #  # ][ #  # ]:          0 :             *aPaM.GetMark() = pMark->GetMarkEnd();
    3568                 :            :         }
    3569         [ #  # ]:          0 :         ::rtl::OUString sMarkName = pMark->GetName();
    3570                 :            : 
    3571                 :            :         // remove mark
    3572         [ #  # ]:          0 :         pServerObject->SetNoServer(); // this removes the connection between SwServerObject and mark
    3573                 :            :         // N.B. ppMark was not loaded from file and cannot have xml:id
    3574         [ #  # ]:          0 :         pMarkAccess->deleteMark(ppMark);
    3575                 :            : 
    3576                 :            :         // recreate as Bookmark
    3577                 :            :         ::sw::mark::IMark* const pNewMark = pMarkAccess->makeMark(
    3578                 :            :             aPaM,
    3579                 :            :             sMarkName,
    3580         [ #  # ]:          0 :             IDocumentMarkAccess::BOOKMARK);
    3581 [ #  # ][ #  # ]:          0 :         pServerObject->SetDdeBookmark(*pNewMark);
    3582                 :            :     }
    3583                 :            : 
    3584                 :          0 :     bDelBookmrk = false;
    3585                 :          0 :     return true;
    3586                 :            : }
    3587                 :            : 
    3588                 :          0 : void SwTrnsfrDdeLink::Disconnect( sal_Bool bRemoveDataAdvise )
    3589                 :            : {
    3590                 :            :     //  don't accept DataChanged anymore, when already in Disconnect!
    3591                 :            :     //  (DTOR from Bookmark sends a DataChanged!)
    3592                 :          0 :     sal_Bool bOldDisconnect = bInDisconnect;
    3593                 :          0 :     bInDisconnect = sal_True;
    3594                 :            : 
    3595                 :            :     // destroy the unused bookmark again (without Undo!)?
    3596 [ #  # ][ #  # ]:          0 :     if( bDelBookmrk && refObj.Is() && FindDocShell() )
         [ #  # ][ #  # ]
    3597                 :            :     {
    3598                 :          0 :         SwDoc* pDoc = pDocShell->GetDoc();
    3599 [ #  # ][ #  # ]:          0 :         ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
    3600                 :            : 
    3601                 :            :         // #i58448#
    3602                 :          0 :         Link aSavedOle2Link( pDoc->GetOle2Link() );
    3603         [ #  # ]:          0 :         pDoc->SetOle2Link( Link() );
    3604                 :            : 
    3605         [ #  # ]:          0 :         sal_Bool bIsModified = pDoc->IsModified();
    3606                 :            : 
    3607         [ #  # ]:          0 :         IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
    3608 [ #  # ][ #  # ]:          0 :         pMarkAccess->deleteMark(pMarkAccess->findMark(sName));
                 [ #  # ]
    3609                 :            : 
    3610         [ #  # ]:          0 :         if( !bIsModified )
    3611         [ #  # ]:          0 :             pDoc->ResetModified();
    3612                 :            :         // #i58448#
    3613                 :          0 :         pDoc->SetOle2Link( aSavedOle2Link );
    3614                 :            : 
    3615         [ #  # ]:          0 :         bDelBookmrk = sal_False;
    3616                 :            :     }
    3617                 :            : 
    3618         [ #  # ]:          0 :     if( refObj.Is() )
    3619                 :            :     {
    3620                 :          0 :         refObj->SetUpdateTimeout( nOldTimeOut );
    3621                 :          0 :         refObj->RemoveConnectAdvise( this );
    3622         [ #  # ]:          0 :         if( bRemoveDataAdvise )
    3623                 :            :             // in a DataChanged the SelectionObject must NEVER be deleted
    3624                 :            :             // is already handled by the base class
    3625                 :            :             // (ADVISEMODE_ONLYONCE!!!!)
    3626                 :            :             // but always in normal Disconnect!
    3627                 :          0 :             refObj->RemoveAllDataAdvise( this );
    3628                 :          0 :         refObj.Clear();
    3629                 :            :     }
    3630                 :          0 :     bInDisconnect = bOldDisconnect;
    3631                 :          0 : }
    3632                 :            : 
    3633                 :          0 : sal_Bool SwTrnsfrDdeLink::FindDocShell()
    3634                 :            : {
    3635         [ #  # ]:          0 :     TypeId aType( TYPE( SwDocShell ) );
    3636         [ #  # ]:          0 :     SfxObjectShell* pTmpSh = SfxObjectShell::GetFirst( &aType );
    3637         [ #  # ]:          0 :     while( pTmpSh )
    3638                 :            :     {
    3639         [ #  # ]:          0 :         if( pTmpSh == pDocShell )       // that's what we want to have
    3640                 :            :         {
    3641         [ #  # ]:          0 :             if( pDocShell->GetDoc() )
    3642                 :          0 :                 return sal_True;
    3643                 :          0 :             break;      // the Doc is not there anymore, so leave!
    3644                 :            :         }
    3645         [ #  # ]:          0 :         pTmpSh = SfxObjectShell::GetNext( *pTmpSh, &aType );
    3646                 :            :     }
    3647                 :            : 
    3648                 :          0 :     pDocShell = 0;
    3649                 :          0 :     return sal_False;
    3650                 :            : }
    3651                 :            : 
    3652                 :          0 : void SwTrnsfrDdeLink::Closed()
    3653                 :            : {
    3654 [ #  # ][ #  # ]:          0 :     if( !bInDisconnect && refObj.Is() )
                 [ #  # ]
    3655                 :            :     {
    3656                 :          0 :         refObj->RemoveAllDataAdvise( this );
    3657                 :          0 :         refObj->RemoveConnectAdvise( this );
    3658                 :          0 :         refObj.Clear();
    3659                 :            :     }
    3660                 :          0 : }
    3661                 :            : 
    3662                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10