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 : bool bDragWasInternal;
55 : bool bUsedForLink;
56 : bool bHasFiltered; // if has filtered rows
57 : bool bUseInApi; // to recognize clipboard content copied from API
58 :
59 : // #i123405# added parameter to allow size calculation without limitation
60 : // to PageSize, e.g. used for Metafile creation for clipboard.
61 : void InitDocShell(bool bLimitToPageSize);
62 : static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY,
63 : SCCOL nEndX, SCROW nEndY,
64 : ScDocument* pDestDoc=0,
65 : SCCOL nSubX=0, SCROW nSubY=0 );
66 : static void PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor,
67 : const ScRange& rBlock, bool bMetaFile );
68 : static void GetAreaSize( ScDocument* pDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol );
69 :
70 : public:
71 : ScTransferObj( ScDocument* pClipDoc, const TransferableObjectDescriptor& rDesc );
72 : virtual ~ScTransferObj();
73 :
74 : virtual void AddSupportedFormats() SAL_OVERRIDE;
75 : virtual bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
76 : virtual bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
77 : const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
78 : virtual void ObjectReleased() SAL_OVERRIDE;
79 : virtual void DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE;
80 :
81 0 : ScDocument* GetDocument() { return pDoc; } // owned by ScTransferObj
82 0 : const ScRange& GetRange() const { return aBlock; }
83 0 : SCROW GetNonFilteredRows() const { return nNonFiltered; }
84 0 : SCCOL GetDragHandleX() const { return nDragHandleX; }
85 0 : SCROW GetDragHandleY() const { return nDragHandleY; }
86 0 : SCTAB GetVisibleTab() const { return nVisibleTab; }
87 0 : sal_uInt16 GetDragSourceFlags() const { return nDragSourceFlags; }
88 0 : bool HasFilteredRows() const { return bHasFiltered; }
89 0 : bool GetUseInApi() const { return bUseInApi; }
90 : ScDocShell* GetSourceDocShell();
91 : ScDocument* GetSourceDocument();
92 : ScMarkData GetSourceMarkData();
93 :
94 : void SetDrawPersist( const SfxObjectShellRef& rRef );
95 : void SetDragHandlePos( SCCOL nX, SCROW nY );
96 : void SetVisibleTab( SCTAB nNew );
97 : void SetDragSource( ScDocShell* pSourceShell, const ScMarkData& rMark );
98 : void SetDragSourceFlags( sal_uInt16 nFlags );
99 : void SetDragWasInternal();
100 : SC_DLLPUBLIC void SetUseInApi( bool bSet );
101 :
102 : static SC_DLLPUBLIC ScTransferObj* GetOwnClipboard( Window* pUIWin );
103 :
104 : static SfxObjectShell* SetDrawClipDoc( bool bAnyOle ); // update ScGlobal::pDrawClipDocShellRef
105 : virtual sal_Int64 SAL_CALL getSomething( const com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
106 : static const com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
107 : };
108 :
109 : #endif
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|