xref: /AOO41X/main/sc/source/ui/inc/transobj.hxx (revision fe22d2cfc602815794415026f1317bd625db6f83)
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     // #123405# added parameter to allow size calculation without limitation
66     // to PageSize, e.g. used for Metafile creation for clipboard.
67     void        InitDocShell(bool bLimitToPageSize);
68     static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY,
69                             SCCOL nEndX, SCROW nEndY,
70                             ScDocument* pDestDoc=0,
71                             SCCOL nSubX=0, SCROW nSubY=0 );
72     static void PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor,
73                             const ScRange& rBlock, sal_Bool bMetaFile );
74     static void GetAreaSize( ScDocument* pDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol );
75 
76 public:
77             ScTransferObj( ScDocument* pClipDoc, const TransferableObjectDescriptor& rDesc );
78     virtual ~ScTransferObj();
79 
80     virtual void        AddSupportedFormats();
81     virtual sal_Bool    GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
82     virtual sal_Bool    WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
83                                         const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
84     virtual void        ObjectReleased();
85     virtual void        DragFinished( sal_Int8 nDropAction );
86 
GetDocument()87     ScDocument*         GetDocument()           { return pDoc; }        // owned by ScTransferObj
GetRange() const88     const ScRange&      GetRange() const        { return aBlock; }
GetNonFilteredRows() const89     SCROW               GetNonFilteredRows() const { return nNonFiltered; }
GetDragHandleX() const90     SCCOL               GetDragHandleX() const  { return nDragHandleX; }
GetDragHandleY() const91     SCROW               GetDragHandleY() const  { return nDragHandleY; }
GetVisibleTab() const92     SCTAB               GetVisibleTab() const   { return nVisibleTab; }
GetDragSourceFlags() const93     sal_uInt16              GetDragSourceFlags() const  { return nDragSourceFlags; }
HasFilteredRows() const94     bool                HasFilteredRows() const { return bHasFiltered; }
GetUseInApi() const95     bool                GetUseInApi() const     { return bUseInApi; }
96     ScDocShell*         GetSourceDocShell();
97     ScDocument*         GetSourceDocument();
98     ScMarkData          GetSourceMarkData();
99 
100     void                SetDrawPersist( const SfxObjectShellRef& rRef );
101     void                SetDragHandlePos( SCCOL nX, SCROW nY );
102     void                SetVisibleTab( SCTAB nNew );
103     void                SetDragSource( ScDocShell* pSourceShell, const ScMarkData& rMark );
104     void                SetDragSourceFlags( sal_uInt16 nFlags );
105     void                SetDragWasInternal();
106     SC_DLLPUBLIC void   SetUseInApi( bool bSet );
107 
108     static SC_DLLPUBLIC ScTransferObj* GetOwnClipboard( Window* pUIWin );
109 
110     static SfxObjectShell*  SetDrawClipDoc( sal_Bool bAnyOle );     // update ScGlobal::pDrawClipDocShellRef
111     virtual sal_Int64 SAL_CALL getSomething( const com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( com::sun::star::uno::RuntimeException );
112     static const com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
113 };
114 
115 #endif
116 
117