LibreOffice Module sot (master) 1
exchange.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_SOT_EXCHANGE_HXX
21#define INCLUDED_SOT_EXCHANGE_HXX
22
23#include <vector>
24#include <com/sun/star/datatransfer/DataFlavor.hpp>
25#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
26#include <sot/sotdllapi.h>
27#include <sot/formats.hxx>
29
31 class XTransferable;
32}
33
34namespace com::sun::star::uno { template <typename > class Reference; }
35
36struct DataFlavorEx : public css::datatransfer::DataFlavor
37{
39};
40
41typedef ::std::vector<DataFlavorEx> DataFlavorExVector;
42
43
44SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector,
46
47// actions
48#define EXCHG_INOUT_ACTION_NONE (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_NONE))
49#define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE
50#define EXCHG_IN_ACTION_MOVE (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_MOVE))
51#define EXCHG_IN_ACTION_COPY (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_COPY))
52#define EXCHG_IN_ACTION_LINK (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_LINK))
53#define EXCHG_OUT_ACTION_INSERT_FILE (sal_uInt8(20))
54#define EXCHG_OUT_ACTION_INSERT_IMAGEMAP (sal_uInt8(22))
55#define EXCHG_OUT_ACTION_INSERT_OLE (sal_uInt8(23))
56#define EXCHG_OUT_ACTION_INSERT_INTERACTIVE (sal_uInt8(24))
57#define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP (sal_uInt8(29))
58#define EXCHG_OUT_ACTION_GET_ATTRIBUTES (sal_uInt8(30))
59#define EXCHG_OUT_ACTION_INSERT_PRIVATE (sal_uInt8(35))
60#define EXCHG_OUT_ACTION_INSERT_HTML (sal_uInt8(36))
61#define EXCHG_OUT_ACTION_MOVE_PRIVATE (sal_uInt8(37))
62#define EXCHG_OUT_ACTION_INSERT_STRING (sal_uInt8(38))
63#define EXCHG_OUT_ACTION_INSERT_DRAWOBJ (sal_uInt8(39))
64#define EXCHG_OUT_ACTION_INSERT_SVXB (sal_uInt8(40))
65#define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE (sal_uInt8(41))
66#define EXCHG_OUT_ACTION_INSERT_BITMAP (sal_uInt8(42))
67#define EXCHG_OUT_ACTION_INSERT_DDE (sal_uInt8(43))
68#define EXCHG_OUT_ACTION_INSERT_HYPERLINK (sal_uInt8(44))
69#define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ (sal_uInt8(45))
70#define EXCHG_OUT_ACTION_REPLACE_SVXB (sal_uInt8(46))
71#define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE (sal_uInt8(47))
72#define EXCHG_OUT_ACTION_REPLACE_BITMAP (sal_uInt8(48))
73#define EXCHG_OUT_ACTION_REPLACE_GRAPH (sal_uInt8(49))
74#define EXCHG_OUT_ACTION_INSERT_GRAPH (sal_uInt8(50))
75
77 NONE = 0x0000,
78 InsertImageMap = 0x0400,
79 ReplaceImageMap = 0x0800,
80 InsertTargetUrl = 0x2000,
81};
82namespace o3tl {
83 template<> struct typed_flags<SotExchangeActionFlags> : is_typed_flags<SotExchangeActionFlags, 0x2c00> {};
84}
85
86// destinations
88{
89 NONE = 0,
90 DOC_OLEOBJ = 1,
92 DOC_TEXTFRAME = 3,
93 DOC_GRAPHOBJ = 4,
98 DOC_DRAWOBJ = 9,
99 DOC_URLBUTTON = 10,
100 DOC_URLFIELD = 11,
101 DOC_GROUPOBJ = 12,
102 SWDOC_FREE_AREA = 13,
103 SCDOC_FREE_AREA = 14,
104 SDDOC_FREE_AREA = 15,
107};
108
109class SvGlobalName;
110
112{
113public:
114 static SotClipboardFormatId RegisterFormat( const css::datatransfer::DataFlavor& rFlavor );
115 static SotClipboardFormatId RegisterFormatName( const OUString& rName );
116 static SotClipboardFormatId RegisterFormatMimeType( const OUString& rMimeType );
117
118 static SotClipboardFormatId GetFormat( const css::datatransfer::DataFlavor& rFlavor );
119 static OUString GetFormatName( SotClipboardFormatId nFormat );
120 static bool GetFormatDataFlavor( SotClipboardFormatId nFormat, css::datatransfer::DataFlavor& rFlavor );
121 static OUString GetFormatMimeType( SotClipboardFormatId nFormat );
122 static bool IsInternal( const SvGlobalName& );
123 static SotClipboardFormatId GetFormatIdFromMimeType( std::u16string_view rMimeType );
124
125 // same for XTransferable interface
126 static sal_uInt8 GetExchangeAction(
127 // XTransferable
128 const DataFlavorExVector& rDataFlavorExVector,
129 // destination of an action
130 SotExchangeDest nDestination,
131 // action for a source
132 sal_uInt16 nSourceOptions,
133 // user action (EXCHG_IN_*, EXCHG_INOUT_*)
134 sal_uInt8 nUserAction,
135 // In:- Out: format to use
136 SotClipboardFormatId& rFormat,
137 // In:- Out: default action (EXCHG_IN_*, EXCHG_INOUT_*)
138 sal_uInt8& rDefaultAction,
139 // In:- optional - check only for this specific format
141 // In:- optional - check the contents of Xtransferable
142 const css::uno::Reference< css::datatransfer::XTransferable >* pxTransferable = nullptr,
143 // Out: optional: - default action flags
144 SotExchangeActionFlags* pActionFlags = nullptr);
145
146 static sal_uInt16 IsChart( const SvGlobalName& rName );
147 static sal_uInt16 IsMath( const SvGlobalName& rName );
148};
149
150#endif
151
152/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
SOT_DLLPUBLIC bool IsFormatSupported(const DataFlavorExVector &rDataFlavorExVector, SotClipboardFormatId nId)
Definition: formats.cxx:1324
SotExchangeActionFlags
Definition: exchange.hxx:76
::std::vector< DataFlavorEx > DataFlavorExVector
Definition: exchange.hxx:41
SotExchangeDest
Definition: exchange.hxx:88
SotClipboardFormatId
Definition: formats.hxx:28
NONE
Reference
#define SOT_DLLPUBLIC
Definition: sotdllapi.h:28
SotClipboardFormatId mnSotId
Definition: exchange.hxx:38
unsigned char sal_uInt8