Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / transobj.hxx
blob9e2e823bfac56517e39e79d966125f03e0078a27
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_TRANSOBJ_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_TRANSOBJ_HXX
23 #include <svtools/transfer.hxx>
24 #include "global.hxx"
25 #include "address.hxx"
27 class ScDocShell;
28 class ScMarkData;
29 class SfxObjectShell;
31 namespace com { namespace sun { namespace star {
32 namespace sheet {
33 class XSheetCellRanges;
35 }}}
37 #include <sfx2/objsh.hxx>
39 class ScTransferObj : public TransferableHelper
41 private:
42 ScDocument* pDoc;
43 ScRange aBlock;
44 SCROW nNonFiltered; // non-filtered rows
45 TransferableObjectDescriptor aObjDesc;
46 SfxObjectShellRef aDocShellRef;
47 SfxObjectShellRef aDrawPersistRef;
48 css::uno::Reference<css::sheet::XSheetCellRanges> xDragSourceRanges;
49 SCCOL nDragHandleX;
50 SCROW nDragHandleY;
51 SCCOL nSourceCursorX;
52 SCROW nSourceCursorY;
53 SCTAB nVisibleTab;
54 sal_uInt16 nDragSourceFlags;
55 bool bDragWasInternal;
56 bool bUsedForLink;
57 bool bHasFiltered; // if has filtered rows
58 bool bUseInApi; // to recognize clipboard content copied from API
60 // #i123405# added parameter to allow size calculation without limitation
61 // to PageSize, e.g. used for Metafile creation for clipboard.
62 void InitDocShell(bool bLimitToPageSize);
63 static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY,
64 SCCOL nEndX, SCROW nEndY,
65 ScDocument* pDestDoc=nullptr,
66 SCCOL nSubX=0, SCROW nSubY=0 );
67 static void PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor,
68 const ScRange& rBlock, bool bMetaFile );
69 static void GetAreaSize( ScDocument* pDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol );
71 public:
72 ScTransferObj( ScDocument* pClipDoc, const TransferableObjectDescriptor& rDesc );
73 virtual ~ScTransferObj();
75 virtual void AddSupportedFormats() override;
76 virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
77 virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, SotClipboardFormatId nUserObjectId,
78 const css::datatransfer::DataFlavor& rFlavor ) override;
79 virtual void ObjectReleased() override;
80 virtual void DragFinished( sal_Int8 nDropAction ) override;
82 ScDocument* GetDocument() { return pDoc; } // owned by ScTransferObj
83 const ScRange& GetRange() const { return aBlock; }
84 SCROW GetNonFilteredRows() const { return nNonFiltered; }
85 SCCOL GetDragHandleX() const { return nDragHandleX; }
86 SCROW GetDragHandleY() const { return nDragHandleY; }
87 bool WasSourceCursorInSelection() const;
88 SCCOL GetSourceCursorX() const { return nSourceCursorX; }
89 SCROW GetSourceCursorY() const { return nSourceCursorY; }
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();
98 void SetDrawPersist( const SfxObjectShellRef& rRef );
99 void SetDragHandlePos( SCCOL nX, SCROW nY );
100 void SetSourceCursorPos( SCCOL nX, SCROW nY );
101 void SetVisibleTab( SCTAB nNew );
102 void SetDragSource( ScDocShell* pSourceShell, const ScMarkData& rMark );
103 void SetDragSourceFlags( sal_uInt16 nFlags );
104 void SetDragWasInternal();
105 SC_DLLPUBLIC void SetUseInApi( bool bSet );
107 static SC_DLLPUBLIC ScTransferObj* GetOwnClipboard( vcl::Window* pUIWin );
109 static SfxObjectShell* SetDrawClipDoc( bool bAnyOle ); // update ScGlobal::xDrawClipDocShellRef
110 virtual sal_Int64 SAL_CALL getSomething( const com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( com::sun::star::uno::RuntimeException, std::exception ) override;
111 static const com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
114 #endif
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */