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 <sfx2/objsh.hxx>
26
27
28class ScDocShell;
29class ScMarkData;
30enum class ScDragSrc;
31
32namespace com::sun::star {
33 namespace sheet {
34 class XSheetCellRanges;
35 }
36}
37
38class SAL_DLLPUBLIC_RTTI ScTransferObj : public TransferDataContainer
39{
40private:
41 std::shared_ptr<ScDocument> m_pDoc;
43 SCROW m_nNonFiltered; // non-filtered rows
47 css::uno::Reference<css::sheet::XSheetCellRanges> m_xDragSourceRanges;
56 bool m_bHasFiltered; // if has filtered rows
57 bool m_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& rDoc, SCCOL nStartX, SCROW nStartY,
63 SCCOL nEndX, SCROW nEndY,
64 ScDocument& rDestDoc );
65 static void PaintToDev( OutputDevice* pDev, ScDocument& rDoc, double nPrintFactor,
66 const ScRange& rBlock );
67 static void GetAreaSize( const ScDocument& rDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol );
68
69public:
70 ScTransferObj( const std::shared_ptr<ScDocument>& pClipDoc, TransferableObjectDescriptor aDesc );
71 virtual ~ScTransferObj() override;
72
73 virtual void AddSupportedFormats() override;
74 virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
75 virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
76 const css::datatransfer::DataFlavor& rFlavor ) override;
77 virtual void DragFinished( sal_Int8 nDropAction ) override;
78 virtual sal_Bool SAL_CALL isComplex() override;
79
80 ScDocument* GetDocument() const { return m_pDoc.get(); } // owned by ScTransferObj
81 const ScRange& GetRange() const { return m_aBlock; }
82 SCROW GetNonFilteredRows() const { return m_nNonFiltered; }
83 SCCOL GetDragHandleX() const { return m_nDragHandleX; }
84 SCROW GetDragHandleY() const { return m_nDragHandleY; }
85 bool WasSourceCursorInSelection() const;
86 SCCOL GetSourceCursorX() const { return m_nSourceCursorX; }
87 SCROW GetSourceCursorY() const { return m_nSourceCursorY; }
88 SCTAB GetVisibleTab() const { return m_nVisibleTab; }
89 ScDragSrc GetDragSourceFlags() const { return m_nDragSourceFlags; }
90 bool HasFilteredRows() const { return m_bHasFiltered; }
91 bool GetUseInApi() const { return m_bUseInApi; }
92 ScDocShell* GetSourceDocShell();
93 ScDocument* GetSourceDocument();
94 ScMarkData GetSourceMarkData() const;
95
96 void SetDrawPersist( const SfxObjectShellRef& rRef );
97 void SetDragHandlePos( SCCOL nX, SCROW nY );
98 void SetSourceCursorPos( SCCOL nX, SCROW nY );
99 void SetVisibleTab( SCTAB nNew );
100 void SetDragSource( ScDocShell* pSourceShell, const ScMarkData& rMark );
101 void SetDragSourceFlags( ScDragSrc nFlags );
102 void SetDragWasInternal();
103 SC_DLLPUBLIC void SetUseInApi( bool bSet );
104
105 static SC_DLLPUBLIC ScTransferObj* GetOwnClipboard(const css::uno::Reference<css::datatransfer::XTransferable2>&);
106
107 static SfxObjectShell* SetDrawClipDoc(bool bAnyOle, const std::shared_ptr<ScDocument>& = {} ); // update ScGlobal::xDrawClipDocShellRef
108 virtual sal_Int64 SAL_CALL getSomething( const com::sun::star::uno::Sequence< sal_Int8 >& rId ) override;
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:90
SCCOL GetSourceCursorX() const
Definition: transobj.hxx:86
SCROW GetSourceCursorY() const
Definition: transobj.hxx:87
ScDragSrc m_nDragSourceFlags
Definition: transobj.hxx:53
const ScRange & GetRange() const
Definition: transobj.hxx:81
SfxObjectShellRef m_aDocShellRef
Definition: transobj.hxx:45
ScRange m_aBlock
Definition: transobj.hxx:42
bool m_bUsedForLink
Definition: transobj.hxx:55
bool m_bDragWasInternal
Definition: transobj.hxx:54
ScDocument * GetDocument() const
Definition: transobj.hxx:80
SCTAB m_nVisibleTab
Definition: transobj.hxx:52
bool GetUseInApi() const
Definition: transobj.hxx:91
SCROW m_nNonFiltered
Definition: transobj.hxx:43
SCCOL m_nDragHandleX
Definition: transobj.hxx:48
SCTAB GetVisibleTab() const
Definition: transobj.hxx:88
SCROW GetDragHandleY() const
Definition: transobj.hxx:84
SCCOL m_nSourceCursorX
Definition: transobj.hxx:50
std::shared_ptr< ScDocument > m_pDoc
Definition: transobj.hxx:41
ScDragSrc GetDragSourceFlags() const
Definition: transobj.hxx:89
SCCOL GetDragHandleX() const
Definition: transobj.hxx:83
css::uno::Reference< css::sheet::XSheetCellRanges > m_xDragSourceRanges
Definition: transobj.hxx:47
SfxObjectShellRef m_aDrawPersistRef
Definition: transobj.hxx:46
SCROW m_nSourceCursorY
Definition: transobj.hxx:51
bool m_bHasFiltered
Definition: transobj.hxx:56
TransferableObjectDescriptor m_aObjDesc
Definition: transobj.hxx:44
SCROW GetNonFilteredRows() const
Definition: transobj.hxx:82
bool m_bUseInApi
Definition: transobj.hxx:57
SCROW m_nDragHandleY
Definition: transobj.hxx:49
virtual void DragFinished(sal_Int8 nDropAction) override
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
virtual void AddSupportedFormats() override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rId) override
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
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