LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/inc - swdtflvr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-12-27 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef _SWDTFLVR_HXX
      20             : #define _SWDTFLVR_HXX
      21             : 
      22             : #include <sfx2/objsh.hxx>
      23             : 
      24             : #include <svtools/transfer.hxx>
      25             : #include <vcl/graph.hxx>
      26             : #include <sfx2/lnkbase.hxx>
      27             : #include <com/sun/star/embed/XEmbeddedObject.hpp>
      28             : 
      29             : class Graphic;
      30             : class ImageMap;
      31             : class INetBookmark;
      32             : class INetImage;
      33             : class SwDoc;
      34             : class SwDocFac;
      35             : class SwTextBlocks;
      36             : class SwWrtShell;
      37             : class SvxClipboardFmtItem;
      38             : class ViewShell;
      39             : class SwView_Impl;
      40             : 
      41             : typedef sal_uInt16 TransferBufferType;
      42             : namespace nsTransferBufferType
      43             : {
      44             :     const sal_uInt16 TRNSFR_NONE            = 0x0000;
      45             :     const sal_uInt16 TRNSFR_DOCUMENT        = 0x0001;
      46             :     const sal_uInt16 TRNSFR_DOCUMENT_WORD   = 0x0002;
      47             :     const sal_uInt16 TRNSFR_GRAPHIC         = 0x0004;
      48             :     const sal_uInt16 TRNSFR_TABELLE         = 0x0008;
      49             :     const sal_uInt16 TRNSFR_DDELINK         = 0x0010;
      50             :     const sal_uInt16 TRNSFR_OLE             = 0x0020;
      51             :     const sal_uInt16 TRNSFR_INETFLD         = 0x0040;
      52             :     const sal_uInt16 TRNSFR_DRAWING         = 0x0081;   // drawing is internal too!
      53             : }
      54             : 
      55             : #define DATA_FLAVOR     ::com::sun::star::datatransfer::DataFlavor
      56             : 
      57             : class SwTransferable : public TransferableHelper
      58             : {
      59             :     friend class SwView_Impl;
      60             :     SfxObjectShellLock             aDocShellRef;
      61             :     TransferableDataHelper          aOleData;
      62             :     TransferableObjectDescriptor    aObjDesc;
      63             :     ::sfx2::SvBaseLinkRef            refDdeLink;
      64             : 
      65             :     SwWrtShell      *pWrtShell;
      66             :     /* #96392# Added pCreatorView to distinguish SwFrameShell from
      67             :        SwWrtShell. */
      68             :     const ViewShell       *pCreatorView;
      69             :     SwDocFac        *pClpDocFac;
      70             :     Graphic         *pClpGraphic, *pClpBitmap, *pOrigGrf;
      71             :     INetBookmark    *pBkmk;     // URL and description!
      72             :     ImageMap        *pImageMap;
      73             :     INetImage       *pTargetURL;
      74             : 
      75             :     TransferBufferType eBufferType;
      76             : 
      77             :     sal_Bool bOldIdle   :1; //D&D Idle flag from the viewsettings
      78             :     sal_Bool bCleanUp   :1; //D&D cleanup after Drop (not by internal Drop)
      79             : 
      80             :     // helper methods for the copy
      81             :     com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > FindOLEObj( sal_Int64& nAspect ) const;
      82             :     Graphic* FindOLEReplacementGraphic() const;
      83             :     void DeleteSelection();
      84             : 
      85             :     // helper methods for the paste
      86             :     static SwTransferable* GetSwTransferable( const TransferableDataHelper& rData );
      87             :     static void SetSelInShell( SwWrtShell& , sal_Bool , const Point* );
      88             :     static sal_Bool _CheckForURLOrLNKFile( TransferableDataHelper& rData,
      89             :                                 String& rFileName, String* pTitle = 0 );
      90             :     static int _TestAllowedFormat( const TransferableDataHelper& rData,
      91             :                                         sal_uLong nFormat, sal_uInt16 nDestination );
      92             : 
      93             :     static int _PasteFileContent( TransferableDataHelper&,
      94             :                                     SwWrtShell& rSh, sal_uLong nFmt, sal_Bool bMsg );
      95             :     static int _PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh,
      96             :                             sal_uLong nFmt, sal_uInt8 nActionFlags, sal_Bool bMsg );
      97             :     static int _PasteTargetURL( TransferableDataHelper& rData, SwWrtShell& rSh,
      98             :                         sal_uInt16 nAction, const Point* pPt, sal_Bool bInsertGRF );
      99             : 
     100             :     static int _PasteDDE( TransferableDataHelper& rData, SwWrtShell& rWrtShell,
     101             :                             sal_Bool bReReadGrf, sal_Bool bMsg );
     102             : 
     103             :     static int _PasteSdrFormat(  TransferableDataHelper& rData,
     104             :                                     SwWrtShell& rSh, sal_uInt16 nAction,
     105             :                                     const Point* pPt, sal_uInt8 nActionFlags );
     106             : 
     107             :     static int _PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
     108             :                                 sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt,
     109             :                                 sal_uInt8 nActionFlags, sal_Bool bMsg );
     110             : 
     111             :     static int _PasteImageMap( TransferableDataHelper& rData,
     112             :                                     SwWrtShell& rSh );
     113             : 
     114             :     static int _PasteAsHyperlink( TransferableDataHelper& rData,
     115             :                                         SwWrtShell& rSh, sal_uLong nFmt );
     116             : 
     117             :     static int _PasteFileName( TransferableDataHelper& rData,
     118             :                             SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction,
     119             :                             const Point* pPt, sal_uInt8 nActionFlags, sal_Bool bMsg );
     120             : 
     121             :     static int _PasteDBData( TransferableDataHelper& rData, SwWrtShell& rSh,
     122             :                             sal_uLong nFmt, sal_Bool bLink, const Point* pDragPt,
     123             :                             sal_Bool bMsg );
     124             : 
     125             :     static int _PasteFileList( TransferableDataHelper& rData,
     126             :                                 SwWrtShell& rSh, sal_Bool bLink,
     127             :                                 const Point* pPt, sal_Bool bMsg );
     128             : 
     129             :     int PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, sal_Bool bMove,
     130             :                         sal_Bool bIsXSelection );
     131             :     int PrivatePaste( SwWrtShell& rShell );
     132             : 
     133             :     void SetDataForDragAndDrop( const Point& rSttPos );
     134             : 
     135             :                                     // not available
     136             :                                     SwTransferable();
     137             :                                     SwTransferable( const SwTransferable& );
     138             :     SwTransferable&                 operator=( const SwTransferable& );
     139             : 
     140             : protected:
     141             :     virtual void        AddSupportedFormats();
     142             :     virtual sal_Bool    GetData( const DATA_FLAVOR& rFlavor );
     143             :     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm,
     144             :                                         void* pUserObject,
     145             :                                         sal_uInt32 nUserObjectId,
     146             :                                         const DATA_FLAVOR& rFlavor );
     147             :     virtual void        DragFinished( sal_Int8 nDropAction );
     148             :     virtual void        ObjectReleased();
     149             : 
     150             :     using TransferableHelper::StartDrag;
     151             : 
     152             : public:
     153             :     SwTransferable( SwWrtShell& );
     154             :     virtual ~SwTransferable();
     155             : 
     156             :     static sal_uInt16 GetSotDestination( const SwWrtShell& rSh, const Point* = 0 );
     157             : 
     158             :     // set properties on the document, like PageMargin, VisArea.
     159             :     // And set real Size
     160             :     static void InitOle( SfxObjectShell* pDoc, SwDoc& rDoc );
     161             : 
     162             :     // copy - methods and helper methods for the copy
     163             :     int  Cut();
     164             :     int  Copy( sal_Bool bIsCut = sal_False );
     165             :     int  PrepareForCopy( sal_Bool bIsCut = sal_False );
     166             :     int  CalculateAndCopy();                // special for Calculator
     167             :     int  CopyGlossary( SwTextBlocks& rGlossary, const String& rStr );
     168             : 
     169             :     // remove the DDE-Link format promise
     170             :     void RemoveDDELinkFormat( const Window& rWin );
     171             : 
     172             :     // paste - methods and helper methods for the paste
     173             :     static sal_Bool IsPaste( const SwWrtShell&, const TransferableDataHelper& );
     174             :     static int Paste( SwWrtShell&, TransferableDataHelper& );
     175             :     static int PasteData( TransferableDataHelper& rData,
     176             :                           SwWrtShell& rSh, sal_uInt16 nAction, sal_uLong nFormat,
     177             :                           sal_uInt16 nDestination, sal_Bool bIsPasteFmt,
     178             :                           sal_Bool bIsDefault,
     179             :                           const Point* pDDPos = 0, sal_Int8 nDropAction = 0,
     180             :                           sal_Bool bPasteSelection = sal_False );
     181             : 
     182             :     static sal_Bool IsPasteSpecial( const SwWrtShell& rWrtShell,
     183             :                                 const TransferableDataHelper& );
     184             :     static int PasteUnformatted( SwWrtShell& rSh, TransferableDataHelper& );
     185             :     static int PasteSpecial( SwWrtShell& rSh, TransferableDataHelper&, sal_uLong& rFormatUsed );
     186             :     static int PasteFormat( SwWrtShell& rSh, TransferableDataHelper& rData,
     187             :                              sal_uLong nFormat );
     188             : 
     189             :     static void FillClipFmtItem( const SwWrtShell& rSh,
     190             :                                 const TransferableDataHelper& rData,
     191             :                                 SvxClipboardFmtItem & rToFill );
     192             : 
     193             :     // Interfaces for Drag & Drop
     194             :     void StartDrag( Window* pWin, const Point& rPos );
     195             : 
     196           0 :     SwWrtShell* GetShell()              { return pWrtShell; }
     197           0 :     void SetCleanUp( sal_Bool bFlag )       { bCleanUp = bFlag; }
     198             : 
     199             :     // Interfaces for Selection
     200             :     /* #96392# Added pCreator to distinguish SwFrameShell from SwWrtShell. */
     201             :     static void CreateSelection( SwWrtShell & rSh,
     202             :                                  const ViewShell * pCreator = NULL );
     203             :     static void ClearSelection( SwWrtShell& rSh,
     204             :                                 const ViewShell * pCreator = NULL );
     205             : 
     206             :     // the related SwView is being closed and the SwTransferable is invalid now
     207           0 :     void    Invalidate() {pWrtShell = 0;}
     208             :     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
     209             : 
     210             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
     211             : };
     212             : 
     213             : 
     214             : #endif
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10