1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SC_SOURCE_UI_INC_TRANSOBJ_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_TRANSOBJ_HXX
23 #include <svtools/transfer.hxx>
25 #include "address.hxx"
31 namespace com
{ namespace sun
{ namespace star
{
33 class XSheetCellRanges
;
37 #include <sfx2/objsh.hxx>
39 class ScTransferObj
: public TransferableHelper
44 SCROW nNonFiltered
; // non-filtered rows
45 TransferableDataHelper aOleData
;
46 TransferableObjectDescriptor aObjDesc
;
47 SfxObjectShellRef aDocShellRef
;
48 SfxObjectShellRef aDrawPersistRef
;
49 com::sun::star::uno::Reference
<com::sun::star::sheet::XSheetCellRanges
> xDragSourceRanges
;
53 sal_uInt16 nDragSourceFlags
;
54 bool bDragWasInternal
;
56 bool bHasFiltered
; // if has filtered rows
57 bool bUseInApi
; // to recognize clipboard content copied from API
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
* pDoc
, SCCOL nStartX
, SCROW nStartY
,
63 SCCOL nEndX
, SCROW nEndY
,
64 ScDocument
* pDestDoc
=0,
65 SCCOL nSubX
=0, SCROW nSubY
=0 );
66 static void PaintToDev( OutputDevice
* pDev
, ScDocument
* pDoc
, double nPrintFactor
,
67 const ScRange
& rBlock
, bool bMetaFile
);
68 static void GetAreaSize( ScDocument
* pDoc
, SCTAB nTab1
, SCTAB nTab2
, SCROW
& nRow
, SCCOL
& nCol
);
71 ScTransferObj( ScDocument
* pClipDoc
, const TransferableObjectDescriptor
& rDesc
);
72 virtual ~ScTransferObj();
74 virtual void AddSupportedFormats() SAL_OVERRIDE
;
75 virtual bool GetData( const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& rDestDoc
) SAL_OVERRIDE
;
76 virtual bool WriteObject( tools::SvRef
<SotStorageStream
>& rxOStm
, void* pUserObject
, SotClipboardFormatId nUserObjectId
,
77 const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
) SAL_OVERRIDE
;
78 virtual void ObjectReleased() SAL_OVERRIDE
;
79 virtual void DragFinished( sal_Int8 nDropAction
) SAL_OVERRIDE
;
81 ScDocument
* GetDocument() { return pDoc
; } // owned by ScTransferObj
82 const ScRange
& GetRange() const { return aBlock
; }
83 SCROW
GetNonFilteredRows() const { return nNonFiltered
; }
84 SCCOL
GetDragHandleX() const { return nDragHandleX
; }
85 SCROW
GetDragHandleY() const { return nDragHandleY
; }
86 SCTAB
GetVisibleTab() const { return nVisibleTab
; }
87 sal_uInt16
GetDragSourceFlags() const { return nDragSourceFlags
; }
88 bool HasFilteredRows() const { return bHasFiltered
; }
89 bool GetUseInApi() const { return bUseInApi
; }
90 ScDocShell
* GetSourceDocShell();
91 ScDocument
* GetSourceDocument();
92 ScMarkData
GetSourceMarkData();
94 void SetDrawPersist( const SfxObjectShellRef
& rRef
);
95 void SetDragHandlePos( SCCOL nX
, SCROW nY
);
96 void SetVisibleTab( SCTAB nNew
);
97 void SetDragSource( ScDocShell
* pSourceShell
, const ScMarkData
& rMark
);
98 void SetDragSourceFlags( sal_uInt16 nFlags
);
99 void SetDragWasInternal();
100 SC_DLLPUBLIC
void SetUseInApi( bool bSet
);
102 static SC_DLLPUBLIC ScTransferObj
* GetOwnClipboard( vcl::Window
* pUIWin
);
104 static SfxObjectShell
* SetDrawClipDoc( bool bAnyOle
); // update ScGlobal::pDrawClipDocShellRef
105 virtual sal_Int64 SAL_CALL
getSomething( const com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
106 static const com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */