xref: /AOO41X/main/sc/source/ui/inc/transobj.hxx (revision 8809db7a87f97847b57a57f4cd2b0104b2b83182)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_TRANSOBJ_HXX
25 #define SC_TRANSOBJ_HXX
26 
27 #include <svtools/transfer.hxx>
28 #include "global.hxx"
29 #include "address.hxx"
30 
31 class ScDocShell;
32 class ScMarkData;
33 class SfxObjectShell;
34 
35 namespace com { namespace sun { namespace star {
36     namespace sheet {
37         class XSheetCellRanges;
38     }
39 }}}
40 
41 #include <sfx2/objsh.hxx>
42 
43 class ScTransferObj : public TransferableHelper
44 {
45 private:
46     ScDocument*                     pDoc;
47     ScRange                         aBlock;
48     SCROW                           nNonFiltered;       // non-filtered rows
49     TransferableDataHelper          aOleData;
50     TransferableObjectDescriptor    aObjDesc;
51 //REMOVE        SvEmbeddedObjectRef             aDocShellRef;
52 //REMOVE        SvEmbeddedObjectRef             aDrawPersistRef;
53     SfxObjectShellRef               aDocShellRef;
54     SfxObjectShellRef               aDrawPersistRef;
55     com::sun::star::uno::Reference<com::sun::star::sheet::XSheetCellRanges> xDragSourceRanges;
56     SCCOL                           nDragHandleX;
57     SCROW                           nDragHandleY;
58     SCTAB                           nVisibleTab;
59     sal_uInt16                          nDragSourceFlags;
60     sal_Bool                            bDragWasInternal;
61     sal_Bool                            bUsedForLink;
62     bool                            bHasFiltered;       // if has filtered rows
63     bool                            bUseInApi;          // to recognize clipboard content copied from API
64 
65     void        InitDocShell();
66     static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY,
67                             SCCOL nEndX, SCROW nEndY,
68                             ScDocument* pDestDoc=0,
69                             SCCOL nSubX=0, SCROW nSubY=0 );
70     static void PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor,
71                             const ScRange& rBlock, sal_Bool bMetaFile );
72     static void GetAreaSize( ScDocument* pDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol );
73 
74 public:
75             ScTransferObj( ScDocument* pClipDoc, const TransferableObjectDescriptor& rDesc );
76     virtual ~ScTransferObj();
77 
78     virtual void        AddSupportedFormats();
79     virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
80     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
81                                         const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
82     virtual void        ObjectReleased();
83     virtual void        DragFinished( sal_Int8 nDropAction );
84 
85     ScDocument*         GetDocument()           { return pDoc; }        // owned by ScTransferObj
86     const ScRange&      GetRange() const        { return aBlock; }
87     SCROW               GetNonFilteredRows() const { return nNonFiltered; }
88     SCCOL               GetDragHandleX() const  { return nDragHandleX; }
89     SCROW               GetDragHandleY() const  { return nDragHandleY; }
90     SCTAB               GetVisibleTab() const   { return nVisibleTab; }
91     sal_uInt16              GetDragSourceFlags() const  { return nDragSourceFlags; }
92     bool                HasFilteredRows() const { return bHasFiltered; }
93     bool                GetUseInApi() const     { return bUseInApi; }
94     ScDocShell*         GetSourceDocShell();
95     ScDocument*         GetSourceDocument();
96     ScMarkData          GetSourceMarkData();
97 
98     void                SetDrawPersist( const SfxObjectShellRef& rRef );
99     void                SetDragHandlePos( SCCOL nX, SCROW nY );
100     void                SetVisibleTab( SCTAB nNew );
101     void                SetDragSource( ScDocShell* pSourceShell, const ScMarkData& rMark );
102     void                SetDragSourceFlags( sal_uInt16 nFlags );
103     void                SetDragWasInternal();
104     SC_DLLPUBLIC void   SetUseInApi( bool bSet );
105 
106     static SC_DLLPUBLIC ScTransferObj* GetOwnClipboard( Window* pUIWin );
107 
108     static SfxObjectShell*  SetDrawClipDoc( sal_Bool bAnyOle );     // update ScGlobal::pDrawClipDocShellRef
109     virtual sal_Int64 SAL_CALL getSomething( const com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( com::sun::star::uno::RuntimeException );
110     static const com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
111 };
112 
113 #endif
114 
115