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