1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <vcl/transfer.hxx>
24 #include <address.hxx>
25 #include <document.hxx>
26 #include <sfx2/objsh.hxx>
33 namespace com::sun::star
{
35 class XSheetCellRanges
;
39 class SAL_DLLPUBLIC_RTTI ScTransferObj
: public TransferDataContainer
42 ScDocumentUniquePtr m_pDoc
;
44 SCROW m_nNonFiltered
; // non-filtered rows
45 TransferableObjectDescriptor m_aObjDesc
;
46 SfxObjectShellRef m_aDocShellRef
;
47 SfxObjectShellRef m_aDrawPersistRef
;
48 css::uno::Reference
<css::sheet::XSheetCellRanges
> m_xDragSourceRanges
;
51 SCCOL m_nSourceCursorX
;
52 SCROW m_nSourceCursorY
;
54 ScDragSrc m_nDragSourceFlags
;
55 bool m_bDragWasInternal
;
57 bool m_bHasFiltered
; // if has filtered rows
58 bool m_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
& rDoc
, SCCOL nStartX
, SCROW nStartY
,
64 SCCOL nEndX
, SCROW nEndY
,
65 ScDocument
& rDestDoc
);
66 static void PaintToDev( OutputDevice
* pDev
, ScDocument
& rDoc
, double nPrintFactor
,
67 const ScRange
& rBlock
);
68 static void GetAreaSize( const ScDocument
& rDoc
, SCTAB nTab1
, SCTAB nTab2
, SCROW
& nRow
, SCCOL
& nCol
);
71 ScTransferObj( ScDocumentUniquePtr pClipDoc
, const TransferableObjectDescriptor
& rDesc
);
72 virtual ~ScTransferObj() override
;
74 virtual void AddSupportedFormats() override
;
75 virtual bool GetData( const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& rDestDoc
) override
;
76 virtual bool WriteObject( tools::SvRef
<SotStorageStream
>& rxOStm
, void* pUserObject
, sal_uInt32 nUserObjectId
,
77 const css::datatransfer::DataFlavor
& rFlavor
) override
;
78 virtual void DragFinished( sal_Int8 nDropAction
) override
;
79 virtual sal_Bool SAL_CALL
isComplex() override
;
81 ScDocument
* GetDocument() const { return m_pDoc
.get(); } // owned by ScTransferObj
82 const ScRange
& GetRange() const { return m_aBlock
; }
83 SCROW
GetNonFilteredRows() const { return m_nNonFiltered
; }
84 SCCOL
GetDragHandleX() const { return m_nDragHandleX
; }
85 SCROW
GetDragHandleY() const { return m_nDragHandleY
; }
86 bool WasSourceCursorInSelection() const;
87 SCCOL
GetSourceCursorX() const { return m_nSourceCursorX
; }
88 SCROW
GetSourceCursorY() const { return m_nSourceCursorY
; }
89 SCTAB
GetVisibleTab() const { return m_nVisibleTab
; }
90 ScDragSrc
GetDragSourceFlags() const { return m_nDragSourceFlags
; }
91 bool HasFilteredRows() const { return m_bHasFiltered
; }
92 bool GetUseInApi() const { return m_bUseInApi
; }
93 ScDocShell
* GetSourceDocShell();
94 ScDocument
* GetSourceDocument();
95 ScMarkData
GetSourceMarkData() const;
97 void SetDrawPersist( const SfxObjectShellRef
& rRef
);
98 void SetDragHandlePos( SCCOL nX
, SCROW nY
);
99 void SetSourceCursorPos( SCCOL nX
, SCROW nY
);
100 void SetVisibleTab( SCTAB nNew
);
101 void SetDragSource( ScDocShell
* pSourceShell
, const ScMarkData
& rMark
);
102 void SetDragSourceFlags( ScDragSrc nFlags
);
103 void SetDragWasInternal();
104 SC_DLLPUBLIC
void SetUseInApi( bool bSet
);
106 static SC_DLLPUBLIC ScTransferObj
* GetOwnClipboard(const css::uno::Reference
<css::datatransfer::XTransferable2
>&);
108 static SfxObjectShell
* SetDrawClipDoc( bool bAnyOle
); // update ScGlobal::xDrawClipDocShellRef
109 virtual sal_Int64 SAL_CALL
getSomething( const com::sun::star::uno::Sequence
< sal_Int8
>& rId
) override
;
110 static const com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */