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 #ifndef INCLUDED_SC_SOURCE_UI_INC_TRANSOBJ_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_TRANSOBJ_HXX
22 
23 #include <vcl/transfer.hxx>
24 #include <address.hxx>
25 #include <document.hxx>
26 #include <sfx2/objsh.hxx>
27 
28 
29 class ScDocShell;
30 class ScMarkData;
31 enum class ScDragSrc;
32 
33 namespace com::sun::star {
34  namespace sheet {
35  class XSheetCellRanges;
36  }
37 }
38 
39 class SAL_DLLPUBLIC_RTTI ScTransferObj : public TransferDataContainer
40 {
41 private:
44  SCROW m_nNonFiltered; // non-filtered rows
48  css::uno::Reference<css::sheet::XSheetCellRanges> m_xDragSourceRanges;
57  bool m_bHasFiltered; // if has filtered rows
58  bool m_bUseInApi; // to recognize clipboard content copied from API
59 
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 );
69 
70 public:
72  virtual ~ScTransferObj() override;
73 
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;
80 
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;
96 
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 );
105 
106  static SC_DLLPUBLIC ScTransferObj* GetOwnClipboard(const css::uno::Reference<css::datatransfer::XTransferable2>&);
107 
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;
111 };
112 
113 #endif
114 
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SCROW GetDragHandleY() const
Definition: transobj.hxx:85
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
SCROW GetNonFilteredRows() const
Definition: transobj.hxx:83
signed char sal_Int8
const ScRange & GetRange() const
Definition: transobj.hxx:82
bool GetUseInApi() const
Definition: transobj.hxx:92
SfxObjectShellRef m_aDocShellRef
Definition: transobj.hxx:46
virtual void DragFinished(sal_Int8 nDropAction) override
SCTAB GetVisibleTab() const
Definition: transobj.hxx:89
virtual bool WriteObject(tools::SvRef< SotStorageStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
virtual sal_Bool SAL_CALL isComplex() override
exports com.sun.star. sheet
bool HasFilteredRows() const
Definition: transobj.hxx:91
SCROW GetSourceCursorY() const
Definition: transobj.hxx:88
SCCOL m_nSourceCursorX
Definition: transobj.hxx:51
css::uno::Reference< css::sheet::XSheetCellRanges > m_xDragSourceRanges
Definition: transobj.hxx:48
ScDocument * GetDocument() const
Definition: transobj.hxx:81
bool m_bHasFiltered
Definition: transobj.hxx:57
SCROW m_nSourceCursorY
Definition: transobj.hxx:52
ScDragSrc
Definition: viewdata.hxx:92
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2613
sal_Int16 SCCOL
Definition: types.hxx:22
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
TransferableObjectDescriptor m_aObjDesc
Definition: transobj.hxx:45
ScRange m_aBlock
Definition: transobj.hxx:43
SCCOL GetDragHandleX() const
Definition: transobj.hxx:84
SCCOL m_nDragHandleX
Definition: transobj.hxx:49
unsigned char sal_Bool
ScDragSrc GetDragSourceFlags() const
Definition: transobj.hxx:90
bool m_bUseInApi
Definition: transobj.hxx:58
SCTAB m_nVisibleTab
Definition: transobj.hxx:53
bool m_bDragWasInternal
Definition: transobj.hxx:55
ScDragSrc m_nDragSourceFlags
Definition: transobj.hxx:54
ScDocumentUniquePtr m_pDoc
Definition: transobj.hxx:42
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rId) override
sal_Int32 SCROW
Definition: types.hxx:18
SCROW m_nDragHandleY
Definition: transobj.hxx:50
SCCOL GetSourceCursorX() const
Definition: transobj.hxx:87
bool m_bUsedForLink
Definition: transobj.hxx:56
SfxObjectShellRef m_aDrawPersistRef
Definition: transobj.hxx:47
virtual void AddSupportedFormats() override
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
SCROW m_nNonFiltered
Definition: transobj.hxx:44
#define SC_DLLPUBLIC
Definition: scdllapi.h:28
sal_Int16 SCTAB
Definition: types.hxx:23