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 :
20 : #ifndef SC_TRANSOBJ_HXX
21 : #define SC_TRANSOBJ_HXX
22 :
23 : #include <svtools/transfer.hxx>
24 : #include "global.hxx"
25 : #include "address.hxx"
26 :
27 : class ScDocShell;
28 : class ScMarkData;
29 : class SfxObjectShell;
30 :
31 : namespace com { namespace sun { namespace star {
32 : namespace sheet {
33 : class XSheetCellRanges;
34 : }
35 : }}}
36 :
37 : #include <sfx2/objsh.hxx>
38 :
39 : class ScTransferObj : public TransferableHelper
40 : {
41 : private:
42 : ScDocument* pDoc;
43 : ScRange aBlock;
44 : SCROW nNonFiltered; // non-filtered rows
45 : TransferableDataHelper aOleData;
46 : TransferableObjectDescriptor aObjDesc;
47 : SfxObjectShellRef aDocShellRef;
48 : SfxObjectShellRef aDrawPersistRef;
49 : com::sun::star::uno::Reference<com::sun::star::sheet::XSheetCellRanges> xDragSourceRanges;
50 : SCCOL nDragHandleX;
51 : SCROW nDragHandleY;
52 : SCTAB nVisibleTab;
53 : sal_uInt16 nDragSourceFlags;
54 : sal_Bool bDragWasInternal;
55 : sal_Bool bUsedForLink;
56 : bool bHasFiltered; // if has filtered rows
57 : bool bUseInApi; // to recognize clipboard content copied from API
58 :
59 : void InitDocShell();
60 : static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY,
61 : SCCOL nEndX, SCROW nEndY,
62 : ScDocument* pDestDoc=0,
63 : SCCOL nSubX=0, SCROW nSubY=0 );
64 : static void PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor,
65 : const ScRange& rBlock, sal_Bool bMetaFile );
66 : static void GetAreaSize( ScDocument* pDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol );
67 :
68 : public:
69 : ScTransferObj( ScDocument* pClipDoc, const TransferableObjectDescriptor& rDesc );
70 : virtual ~ScTransferObj();
71 :
72 : virtual void AddSupportedFormats();
73 : virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
74 : virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
75 : const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
76 : virtual void ObjectReleased();
77 : virtual void DragFinished( sal_Int8 nDropAction );
78 :
79 0 : ScDocument* GetDocument() { return pDoc; } // owned by ScTransferObj
80 0 : const ScRange& GetRange() const { return aBlock; }
81 0 : SCROW GetNonFilteredRows() const { return nNonFiltered; }
82 0 : SCCOL GetDragHandleX() const { return nDragHandleX; }
83 0 : SCROW GetDragHandleY() const { return nDragHandleY; }
84 0 : SCTAB GetVisibleTab() const { return nVisibleTab; }
85 0 : sal_uInt16 GetDragSourceFlags() const { return nDragSourceFlags; }
86 0 : bool HasFilteredRows() const { return bHasFiltered; }
87 0 : bool GetUseInApi() const { return bUseInApi; }
88 : ScDocShell* GetSourceDocShell();
89 : ScDocument* GetSourceDocument();
90 : ScMarkData GetSourceMarkData();
91 :
92 : void SetDrawPersist( const SfxObjectShellRef& rRef );
93 : void SetDragHandlePos( SCCOL nX, SCROW nY );
94 : void SetVisibleTab( SCTAB nNew );
95 : void SetDragSource( ScDocShell* pSourceShell, const ScMarkData& rMark );
96 : void SetDragSourceFlags( sal_uInt16 nFlags );
97 : void SetDragWasInternal();
98 : SC_DLLPUBLIC void SetUseInApi( bool bSet );
99 :
100 : static SC_DLLPUBLIC ScTransferObj* GetOwnClipboard( Window* pUIWin );
101 :
102 : static SfxObjectShell* SetDrawClipDoc( sal_Bool bAnyOle ); // update ScGlobal::pDrawClipDocShellRef
103 : virtual sal_Int64 SAL_CALL getSomething( const com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( com::sun::star::uno::RuntimeException );
104 : static const com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
105 : };
106 :
107 : #endif
108 :
109 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|