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 
28 class ScDocShell;
29 class ScMarkData;
30 enum class ScDragSrc;
31 
32 namespace com::sun::star {
33  namespace sheet {
34  class XSheetCellRanges;
35  }
36 }
37 
38 class SAL_DLLPUBLIC_RTTI ScTransferObj : public TransferDataContainer
39 {
40 private:
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 
69 public:
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 ); // 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: */
SCROW GetDragHandleY() const
Definition: transobj.hxx:84
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:42
SCROW GetNonFilteredRows() const
Definition: transobj.hxx:82
signed char sal_Int8
const ScRange & GetRange() const
Definition: transobj.hxx:81
bool GetUseInApi() const
Definition: transobj.hxx:91
SfxObjectShellRef m_aDocShellRef
Definition: transobj.hxx:45
virtual void DragFinished(sal_Int8 nDropAction) override
SCTAB GetVisibleTab() const
Definition: transobj.hxx:88
virtual sal_Bool SAL_CALL isComplex() override
exports com.sun.star. sheet
bool HasFilteredRows() const
Definition: transobj.hxx:90
SCROW GetSourceCursorY() const
Definition: transobj.hxx:87
SCCOL m_nSourceCursorX
Definition: transobj.hxx:50
css::uno::Reference< css::sheet::XSheetCellRanges > m_xDragSourceRanges
Definition: transobj.hxx:47
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
ScDocument * GetDocument() const
Definition: transobj.hxx:80
bool m_bHasFiltered
Definition: transobj.hxx:56
SCROW m_nSourceCursorY
Definition: transobj.hxx:51
ScDragSrc
Definition: viewdata.hxx:91
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2616
sal_Int16 SCCOL
Definition: types.hxx:21
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
TransferableObjectDescriptor m_aObjDesc
Definition: transobj.hxx:44
ScRange m_aBlock
Definition: transobj.hxx:42
SCCOL GetDragHandleX() const
Definition: transobj.hxx:83
SCCOL m_nDragHandleX
Definition: transobj.hxx:48
unsigned char sal_Bool
ScDragSrc GetDragSourceFlags() const
Definition: transobj.hxx:89
bool m_bUseInApi
Definition: transobj.hxx:57
SCTAB m_nVisibleTab
Definition: transobj.hxx:52
bool m_bDragWasInternal
Definition: transobj.hxx:54
ScDragSrc m_nDragSourceFlags
Definition: transobj.hxx:53
ScDocumentUniquePtr m_pDoc
Definition: transobj.hxx:41
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rId) override
sal_Int32 SCROW
Definition: types.hxx:17
SCROW m_nDragHandleY
Definition: transobj.hxx:49
SCCOL GetSourceCursorX() const
Definition: transobj.hxx:86
bool m_bUsedForLink
Definition: transobj.hxx:55
SfxObjectShellRef m_aDrawPersistRef
Definition: transobj.hxx:46
virtual void AddSupportedFormats() override
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
SCROW m_nNonFiltered
Definition: transobj.hxx:43
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
sal_Int16 SCTAB
Definition: types.hxx:22