LCOV - code coverage report
Current view: top level - sw/source/ui/inc - swdtflvr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 3 33.3 %
Date: 2012-08-25 Functions: 1 3 33.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 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                 :            : #ifndef _SWDTFLVR_HXX
      29                 :            : #define _SWDTFLVR_HXX
      30                 :            : 
      31                 :            : #include <sfx2/objsh.hxx>
      32                 :            : 
      33                 :            : #include <svtools/transfer.hxx>
      34                 :            : #include <vcl/graph.hxx>
      35                 :            : #include <sfx2/lnkbase.hxx>
      36                 :            : #include <com/sun/star/embed/XEmbeddedObject.hpp>
      37                 :            : 
      38                 :            : class Graphic;
      39                 :            : class ImageMap;
      40                 :            : class INetBookmark;
      41                 :            : class INetImage;
      42                 :            : class SwDoc;
      43                 :            : class SwDocFac;
      44                 :            : class SwTextBlocks;
      45                 :            : class SwWrtShell;
      46                 :            : class SvxClipboardFmtItem;
      47                 :            : class ViewShell;
      48                 :            : class SwView_Impl;
      49                 :            : 
      50                 :            : typedef sal_uInt16 TransferBufferType;
      51                 :            : namespace nsTransferBufferType
      52                 :            : {
      53                 :            :     const sal_uInt16 TRNSFR_NONE            = 0x0000;
      54                 :            :     const sal_uInt16 TRNSFR_DOCUMENT        = 0x0001;
      55                 :            :     const sal_uInt16 TRNSFR_DOCUMENT_WORD   = 0x0002;
      56                 :            :     const sal_uInt16 TRNSFR_GRAPHIC         = 0x0004;
      57                 :            :     const sal_uInt16 TRNSFR_TABELLE         = 0x0008;
      58                 :            :     const sal_uInt16 TRNSFR_DDELINK         = 0x0010;
      59                 :            :     const sal_uInt16 TRNSFR_OLE             = 0x0020;
      60                 :            :     const sal_uInt16 TRNSFR_INETFLD         = 0x0040;
      61                 :            :     const sal_uInt16 TRNSFR_DRAWING         = 0x0081;   // drawing is internal too!
      62                 :            : }
      63                 :            : 
      64                 :            : #define DATA_FLAVOR     ::com::sun::star::datatransfer::DataFlavor
      65                 :            : 
      66                 :            : class SwTransferable : public TransferableHelper
      67                 :            : {
      68                 :            :     friend class SwView_Impl;
      69                 :            :     SfxObjectShellLock             aDocShellRef;
      70                 :            :     TransferableDataHelper          aOleData;
      71                 :            :     TransferableObjectDescriptor    aObjDesc;
      72                 :            :     ::sfx2::SvBaseLinkRef            refDdeLink;
      73                 :            : 
      74                 :            :     SwWrtShell      *pWrtShell;
      75                 :            :     /* #96392# Added pCreatorView to distinguish SwFrameShell from
      76                 :            :        SwWrtShell. */
      77                 :            :     const ViewShell       *pCreatorView;
      78                 :            :     SwDocFac        *pClpDocFac;
      79                 :            :     Graphic         *pClpGraphic, *pClpBitmap, *pOrigGrf;
      80                 :            :     INetBookmark    *pBkmk;     // URL and description!
      81                 :            :     ImageMap        *pImageMap;
      82                 :            :     INetImage       *pTargetURL;
      83                 :            : 
      84                 :            :     TransferBufferType eBufferType;
      85                 :            : 
      86                 :            :     sal_Bool bOldIdle   :1; //D&D Idle flag from the viewsettings
      87                 :            :     sal_Bool bCleanUp   :1; //D&D cleanup after Drop (not by internal Drop)
      88                 :            : 
      89                 :            :     // helper methods for the copy
      90                 :            :     com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > FindOLEObj( sal_Int64& nAspect ) const;
      91                 :            :     Graphic* FindOLEReplacementGraphic() const;
      92                 :            :     void DeleteSelection();
      93                 :            : 
      94                 :            :     // helper methods for the paste
      95                 :            :     static SwTransferable* GetSwTransferable( const TransferableDataHelper& rData );
      96                 :            :     static void SetSelInShell( SwWrtShell& , sal_Bool , const Point* );
      97                 :            :     static sal_Bool _CheckForURLOrLNKFile( TransferableDataHelper& rData,
      98                 :            :                                 String& rFileName, String* pTitle = 0 );
      99                 :            :     static int _TestAllowedFormat( const TransferableDataHelper& rData,
     100                 :            :                                         sal_uLong nFormat, sal_uInt16 nDestination );
     101                 :            : 
     102                 :            :     static int _PasteFileContent( TransferableDataHelper&,
     103                 :            :                                     SwWrtShell& rSh, sal_uLong nFmt, sal_Bool bMsg );
     104                 :            :     static int _PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh,
     105                 :            :                             sal_uLong nFmt, sal_uInt8 nActionFlags, sal_Bool bMsg );
     106                 :            :     static int _PasteTargetURL( TransferableDataHelper& rData, SwWrtShell& rSh,
     107                 :            :                         sal_uInt16 nAction, const Point* pPt, sal_Bool bInsertGRF );
     108                 :            : 
     109                 :            :     static int _PasteDDE( TransferableDataHelper& rData, SwWrtShell& rWrtShell,
     110                 :            :                             sal_Bool bReReadGrf, sal_Bool bMsg );
     111                 :            : 
     112                 :            :     static int _PasteSdrFormat(  TransferableDataHelper& rData,
     113                 :            :                                     SwWrtShell& rSh, sal_uInt16 nAction,
     114                 :            :                                     const Point* pPt, sal_uInt8 nActionFlags );
     115                 :            : 
     116                 :            :     static int _PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
     117                 :            :                                 sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt,
     118                 :            :                                 sal_uInt8 nActionFlags, sal_Bool bMsg );
     119                 :            : 
     120                 :            :     static int _PasteImageMap( TransferableDataHelper& rData,
     121                 :            :                                     SwWrtShell& rSh );
     122                 :            : 
     123                 :            :     static int _PasteAsHyperlink( TransferableDataHelper& rData,
     124                 :            :                                         SwWrtShell& rSh, sal_uLong nFmt );
     125                 :            : 
     126                 :            :     static int _PasteFileName( TransferableDataHelper& rData,
     127                 :            :                             SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction,
     128                 :            :                             const Point* pPt, sal_uInt8 nActionFlags, sal_Bool bMsg );
     129                 :            : 
     130                 :            :     static int _PasteDBData( TransferableDataHelper& rData, SwWrtShell& rSh,
     131                 :            :                             sal_uLong nFmt, sal_Bool bLink, const Point* pDragPt,
     132                 :            :                             sal_Bool bMsg );
     133                 :            : 
     134                 :            :     static int _PasteFileList( TransferableDataHelper& rData,
     135                 :            :                                 SwWrtShell& rSh, sal_Bool bLink,
     136                 :            :                                 const Point* pPt, sal_Bool bMsg );
     137                 :            : 
     138                 :            :     int PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, sal_Bool bMove,
     139                 :            :                         sal_Bool bIsXSelection );
     140                 :            :     int PrivatePaste( SwWrtShell& rShell );
     141                 :            : 
     142                 :            :     void SetDataForDragAndDrop( const Point& rSttPos );
     143                 :            : 
     144                 :            :                                     // not available
     145                 :            :                                     SwTransferable();
     146                 :            :                                     SwTransferable( const SwTransferable& );
     147                 :            :     SwTransferable&                 operator=( const SwTransferable& );
     148                 :            : 
     149                 :            : protected:
     150                 :            :     virtual void        AddSupportedFormats();
     151                 :            :     virtual sal_Bool    GetData( const DATA_FLAVOR& rFlavor );
     152                 :            :     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm,
     153                 :            :                                         void* pUserObject,
     154                 :            :                                         sal_uInt32 nUserObjectId,
     155                 :            :                                         const DATA_FLAVOR& rFlavor );
     156                 :            :     virtual void        DragFinished( sal_Int8 nDropAction );
     157                 :            :     virtual void        ObjectReleased();
     158                 :            : 
     159                 :            :     using TransferableHelper::StartDrag;
     160                 :            : 
     161                 :            : public:
     162                 :            :     SwTransferable( SwWrtShell& );
     163                 :            :     virtual ~SwTransferable();
     164                 :            : 
     165                 :            :     static sal_uInt16 GetSotDestination( const SwWrtShell& rSh, const Point* = 0 );
     166                 :            : 
     167                 :            :     // set properties on the document, like PageMargin, VisArea.
     168                 :            :     // And set real Size
     169                 :            :     static void InitOle( SfxObjectShell* pDoc, SwDoc& rDoc );
     170                 :            : 
     171                 :            :     // copy - methods and helper methods for the copy
     172                 :            :     int  Cut();
     173                 :            :     int  Copy( sal_Bool bIsCut = sal_False );
     174                 :            :     int  PrepareForCopy( sal_Bool bIsCut = sal_False );
     175                 :            :     int  CalculateAndCopy();                // special for Calculator
     176                 :            :     int  CopyGlossary( SwTextBlocks& rGlossary, const String& rStr );
     177                 :            : 
     178                 :            :     // remove the DDE-Link format promise
     179                 :            :     void RemoveDDELinkFormat( const Window& rWin );
     180                 :            : 
     181                 :            :     // paste - methods and helper methods for the paste
     182                 :            :     static sal_Bool IsPaste( const SwWrtShell&, const TransferableDataHelper& );
     183                 :            :     static int Paste( SwWrtShell&, TransferableDataHelper& );
     184                 :            :     static int PasteData( TransferableDataHelper& rData,
     185                 :            :                           SwWrtShell& rSh, sal_uInt16 nAction, sal_uLong nFormat,
     186                 :            :                           sal_uInt16 nDestination, sal_Bool bIsPasteFmt,
     187                 :            :                           sal_Bool bIsDefault,
     188                 :            :                           const Point* pDDPos = 0, sal_Int8 nDropAction = 0,
     189                 :            :                           sal_Bool bPasteSelection = sal_False );
     190                 :            : 
     191                 :            :     static sal_Bool IsPasteSpecial( const SwWrtShell& rWrtShell,
     192                 :            :                                 const TransferableDataHelper& );
     193                 :            :     static int PasteUnformatted( SwWrtShell& rSh, TransferableDataHelper& );
     194                 :            :     static int PasteSpecial( SwWrtShell& rSh, TransferableDataHelper&, sal_uLong& rFormatUsed );
     195                 :            :     static int PasteFormat( SwWrtShell& rSh, TransferableDataHelper& rData,
     196                 :            :                              sal_uLong nFormat );
     197                 :            : 
     198                 :            :     static void FillClipFmtItem( const SwWrtShell& rSh,
     199                 :            :                                 const TransferableDataHelper& rData,
     200                 :            :                                 SvxClipboardFmtItem & rToFill );
     201                 :            : 
     202                 :            :     // Interfaces for Drag & Drop
     203                 :            :     void StartDrag( Window* pWin, const Point& rPos );
     204                 :            : 
     205                 :          0 :     SwWrtShell* GetShell()              { return pWrtShell; }
     206                 :          0 :     void SetCleanUp( sal_Bool bFlag )       { bCleanUp = bFlag; }
     207                 :            : 
     208                 :            :     // Interfaces for Selection
     209                 :            :     /* #96392# Added pCreator to distinguish SwFrameShell from SwWrtShell. */
     210                 :            :     static void CreateSelection( SwWrtShell & rSh,
     211                 :            :                                  const ViewShell * pCreator = NULL );
     212                 :            :     static void ClearSelection( SwWrtShell& rSh,
     213                 :            :                                 const ViewShell * pCreator = NULL );
     214                 :            : 
     215                 :            :     // the related SwView is being closed and the SwTransferable is invalid now
     216                 :          4 :     void    Invalidate() {pWrtShell = 0;}
     217                 :            :     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
     218                 :            : 
     219                 :            :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
     220                 :            : };
     221                 :            : 
     222                 :            : 
     223                 :            : #endif
     224                 :            : 
     225                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10