LibreOffice Module sc (master) 1
transobj.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <vcl/transfer.hxx>
23#include <address.hxx>
24#include <document.hxx>
25#include <rtl/ref.hxx>
26#include <sfx2/objsh.hxx>
27
28
29class ScDocShell;
30class ScMarkData;
31enum class ScDragSrc;
32class ScCellRangesBase;
33
34namespace com::sun::star {
35 namespace sheet {
36 class XSheetCellRanges;
37 }
38}
39
40class SAL_DLLPUBLIC_RTTI ScTransferObj : public TransferDataContainer
41{
42private:
43 std::shared_ptr<ScDocument> m_pDoc;
45 SCROW m_nNonFiltered; // non-filtered rows
58 bool m_bHasFiltered; // if has filtered rows
59 bool m_bUseInApi; // to recognize clipboard content copied from API
60
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 );
70
71public:
72 ScTransferObj( const std::shared_ptr<ScDocument>& pClipDoc, TransferableObjectDescriptor aDesc );
73 virtual ~ScTransferObj() override;
74
75 virtual void AddSupportedFormats() override;
76 virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
77 virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, 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;
81
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;
97
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 );
106
107 static SC_DLLPUBLIC ScTransferObj* GetOwnClipboard(const css::uno::Reference<css::datatransfer::XTransferable2>&);
108
109 static SfxObjectShell* SetDrawClipDoc(bool bAnyOle, const std::shared_ptr<ScDocument>& = {} ); // update ScGlobal::xDrawClipDocShellRef
110};
111
112/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
bool HasFilteredRows() const
Definition: transobj.hxx:92
SCCOL GetSourceCursorX() const
Definition: transobj.hxx:88
SCROW GetSourceCursorY() const
Definition: transobj.hxx:89
ScDragSrc m_nDragSourceFlags
Definition: transobj.hxx:55
const ScRange & GetRange() const
Definition: transobj.hxx:83
SfxObjectShellRef m_aDocShellRef
Definition: transobj.hxx:47
ScRange m_aBlock
Definition: transobj.hxx:44
bool m_bUsedForLink
Definition: transobj.hxx:57
bool m_bDragWasInternal
Definition: transobj.hxx:56
ScDocument * GetDocument() const
Definition: transobj.hxx:82
SCTAB m_nVisibleTab
Definition: transobj.hxx:54
bool GetUseInApi() const
Definition: transobj.hxx:93
SCROW m_nNonFiltered
Definition: transobj.hxx:45
SCCOL m_nDragHandleX
Definition: transobj.hxx:50
SCTAB GetVisibleTab() const
Definition: transobj.hxx:90
SCROW GetDragHandleY() const
Definition: transobj.hxx:86
SCCOL m_nSourceCursorX
Definition: transobj.hxx:52
std::shared_ptr< ScDocument > m_pDoc
Definition: transobj.hxx:43
ScDragSrc GetDragSourceFlags() const
Definition: transobj.hxx:91
SCCOL GetDragHandleX() const
Definition: transobj.hxx:85
SfxObjectShellRef m_aDrawPersistRef
Definition: transobj.hxx:48
rtl::Reference< ScCellRangesBase > m_xDragSourceRanges
Definition: transobj.hxx:49
SCROW m_nSourceCursorY
Definition: transobj.hxx:53
bool m_bHasFiltered
Definition: transobj.hxx:58
TransferableObjectDescriptor m_aObjDesc
Definition: transobj.hxx:46
SCROW GetNonFilteredRows() const
Definition: transobj.hxx:84
bool m_bUseInApi
Definition: transobj.hxx:59
SCROW m_nDragHandleY
Definition: transobj.hxx:51
virtual void DragFinished(sal_Int8 nDropAction) override
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
virtual void AddSupportedFormats() override
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
virtual sal_Bool SAL_CALL isComplex() override
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
unsigned char sal_Bool
signed char sal_Int8
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
ScDragSrc
Definition: viewdata.hxx:91