tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / transobj.hxx
blob8813bf5b40d2abb14320c5e26fa4f27224bed3b4
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 #pragma once
22 #include <vcl/transfer.hxx>
23 #include <address.hxx>
24 #include <document.hxx>
25 #include <rtl/ref.hxx>
26 #include <sfx2/objsh.hxx>
29 class ScDocShell;
30 class ScMarkData;
31 enum class ScDragSrc;
32 class ScCellRangesBase;
34 namespace com::sun::star {
35 namespace sheet {
36 class XSheetCellRanges;
40 class SAL_DLLPUBLIC_RTTI ScTransferObj : public TransferDataContainer
42 private:
43 std::shared_ptr<ScDocument> m_pDoc;
44 ScRange m_aBlock;
45 SCROW m_nNonFiltered; // non-filtered rows
46 TransferableObjectDescriptor m_aObjDesc;
47 rtl::Reference<ScDocShell> m_aDocShellRef;
48 SfxObjectShellRef m_aDrawPersistRef;
49 rtl::Reference<ScCellRangesBase> m_xDragSourceRanges;
50 SCCOL m_nDragHandleX;
51 SCROW m_nDragHandleY;
52 SCCOL m_nSourceCursorX;
53 SCROW m_nSourceCursorY;
54 SCTAB m_nVisibleTab;
55 ScDragSrc m_nDragSourceFlags;
56 bool m_bDragWasInternal;
57 bool m_bUsedForLink;
58 bool m_bHasFiltered; // if has filtered rows
59 bool m_bUseInApi; // to recognize clipboard content copied from API
61 // #i123405# added parameter to allow size calculation without limitation
62 // to PageSize, e.g. used for Metafile creation for clipboard.
63 void InitDocShell(bool bLimitToPageSize);
64 static void StripRefs( ScDocument& rDoc, SCCOL nStartX, SCROW nStartY,
65 SCCOL nEndX, SCROW nEndY,
66 ScDocument& rDestDoc );
67 static void PaintToDev( OutputDevice* pDev, ScDocument& rDoc, double nPrintFactor,
68 const ScRange& rBlock );
69 static void GetAreaSize( const ScDocument& rDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol );
71 public:
72 ScTransferObj( const std::shared_ptr<ScDocument>& pClipDoc, TransferableObjectDescriptor aDesc );
73 virtual ~ScTransferObj() override;
75 virtual void AddSupportedFormats() override;
76 virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
77 virtual bool WriteObject( SvStream& rOStm, void* pUserObject, sal_uInt32 nUserObjectId,
78 const css::datatransfer::DataFlavor& rFlavor ) override;
79 virtual void DragFinished( sal_Int8 nDropAction ) override;
80 virtual sal_Bool SAL_CALL isComplex() override;
82 ScDocument* GetDocument() const { return m_pDoc.get(); } // owned by ScTransferObj
83 const ScRange& GetRange() const { return m_aBlock; }
84 SCROW GetNonFilteredRows() const { return m_nNonFiltered; }
85 SCCOL GetDragHandleX() const { return m_nDragHandleX; }
86 SCROW GetDragHandleY() const { return m_nDragHandleY; }
87 bool WasSourceCursorInSelection() const;
88 SCCOL GetSourceCursorX() const { return m_nSourceCursorX; }
89 SCROW GetSourceCursorY() const { return m_nSourceCursorY; }
90 SCTAB GetVisibleTab() const { return m_nVisibleTab; }
91 ScDragSrc GetDragSourceFlags() const { return m_nDragSourceFlags; }
92 bool HasFilteredRows() const { return m_bHasFiltered; }
93 bool GetUseInApi() const { return m_bUseInApi; }
94 ScDocShell* GetSourceDocShell();
95 ScDocument* GetSourceDocument();
96 ScMarkData GetSourceMarkData() const;
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( ScDragSrc nFlags );
104 void SetDragWasInternal();
105 SC_DLLPUBLIC void SetUseInApi( bool bSet );
107 static SC_DLLPUBLIC ScTransferObj* GetOwnClipboard(const css::uno::Reference<css::datatransfer::XTransferable2>&);
109 static SfxObjectShell* SetDrawClipDoc(bool bAnyOle, const std::shared_ptr<ScDocument>& = {} ); // update ScGlobal::xDrawClipDocShellRef
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */