build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / sot / exchange.hxx
blob307ffea16bb48e04a4462a354376a4360f9fa6ff
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_SOT_EXCHANGE_HXX
21 #define INCLUDED_SOT_EXCHANGE_HXX
23 #include <list>
24 #include <vector>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <com/sun/star/datatransfer/DataFlavor.hpp>
27 #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
28 #include <sot/sotdllapi.h>
29 #include <sot/formats.hxx>
30 #include <tools/solar.h>
31 #include <o3tl/typed_flags_set.hxx>
33 class SotDataObject;
35 namespace com { namespace sun { namespace star { namespace datatransfer {
36 class XTransferable;
37 } } } }
40 struct DataFlavorEx : public css::datatransfer::DataFlavor
42 SotClipboardFormatId mnSotId;
45 typedef ::std::vector<DataFlavorEx> DataFlavorExVector;
48 SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector,
49 SotClipboardFormatId nId );
51 // actions
52 #define EXCHG_INOUT_ACTION_NONE ((sal_uInt8)css::datatransfer::dnd::DNDConstants::ACTION_NONE)
53 #define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE
54 #define EXCHG_IN_ACTION_MOVE ((sal_uInt8)css::datatransfer::dnd::DNDConstants::ACTION_MOVE)
55 #define EXCHG_IN_ACTION_COPY ((sal_uInt8)css::datatransfer::dnd::DNDConstants::ACTION_COPY)
56 #define EXCHG_IN_ACTION_LINK ((sal_uInt8)css::datatransfer::dnd::DNDConstants::ACTION_LINK)
57 #define EXCHG_OUT_ACTION_INSERT_OBJ ((sal_uInt8)17)
58 #define EXCHG_OUT_ACTION_INSERT_BOOKMARK ((sal_uInt8)18)
59 #define EXCHG_OUT_ACTION_INSERT_FILE ((sal_uInt8)20)
60 #define EXCHG_OUT_ACTION_INSERT_IMAGEMAP ((sal_uInt8)22)
61 #define EXCHG_OUT_ACTION_INSERT_OLE ((sal_uInt8)23)
62 #define EXCHG_OUT_ACTION_INSERT_INTERACTIVE ((sal_uInt8)24)
63 #define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP ((sal_uInt8)29)
64 #define EXCHG_OUT_ACTION_GET_ATTRIBUTES ((sal_uInt8)30)
65 #define EXCHG_OUT_ACTION_MOVE_FILE ((sal_uInt8)32)
66 #define EXCHG_OUT_ACTION_MOVE_FILELIST ((sal_uInt8)33)
67 #define EXCHG_OUT_ACTION_UPDATE_RANGE ((sal_uInt8)34)
68 #define EXCHG_OUT_ACTION_INSERT_PRIVATE ((sal_uInt8)35)
69 #define EXCHG_OUT_ACTION_INSERT_HTML ((sal_uInt8)36)
70 #define EXCHG_OUT_ACTION_MOVE_PRIVATE ((sal_uInt8)37)
71 #define EXCHG_OUT_ACTION_INSERT_STRING ((sal_uInt8)38)
72 #define EXCHG_OUT_ACTION_INSERT_DRAWOBJ ((sal_uInt8)39)
73 #define EXCHG_OUT_ACTION_INSERT_SVXB ((sal_uInt8)40)
74 #define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE ((sal_uInt8)41)
75 #define EXCHG_OUT_ACTION_INSERT_BITMAP ((sal_uInt8)42)
76 #define EXCHG_OUT_ACTION_INSERT_DDE ((sal_uInt8)43)
77 #define EXCHG_OUT_ACTION_INSERT_HYPERLINK ((sal_uInt8)44)
78 #define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ ((sal_uInt8)45)
79 #define EXCHG_OUT_ACTION_REPLACE_SVXB ((sal_uInt8)46)
80 #define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE ((sal_uInt8)47)
81 #define EXCHG_OUT_ACTION_REPLACE_BITMAP ((sal_uInt8)48)
82 #define EXCHG_OUT_ACTION_REPLACE_GRAPH ((sal_uInt8)49)
83 #define EXCHG_OUT_ACTION_INSERT_GRAPH ((sal_uInt8)50)
85 enum class SotExchangeActionFlags {
86 NONE = 0x0000,
87 KeepPosSize = 0x0200,
88 InsertImageMap = 0x0400,
89 ReplaceImageMap = 0x0800,
90 Fill = 0x1000,
91 InsertTargetUrl = 0x2000,
93 namespace o3tl {
94 template<> struct typed_flags<SotExchangeActionFlags> : is_typed_flags<SotExchangeActionFlags, 0x3e00> {};
97 // destinations
98 enum class SotExchangeDest
100 NONE = 0,
101 DOC_OLEOBJ = 1,
102 CHARTDOC_OLEOBJ = 2,
103 DOC_TEXTFRAME = 3,
104 DOC_GRAPHOBJ = 4,
105 DOC_LNKD_GRAPHOBJ = 5,
106 DOC_GRAPH_W_IMAP = 6,
107 DOC_LNKD_GRAPH_W_IMAP = 7,
108 DOC_IMAPREGION = 8,
109 DOC_DRAWOBJ = 9,
110 DOC_URLBUTTON = 10,
111 DOC_URLFIELD = 11,
112 DOC_GROUPOBJ = 12,
113 SWDOC_FREE_AREA = 13,
114 SCDOC_FREE_AREA = 14,
115 SDDOC_FREE_AREA = 15,
116 DOC_TEXTFRAME_WEB = 16,
117 SWDOC_FREE_AREA_WEB = 17,
120 class SvGlobalName;
122 class SOT_DLLPUBLIC SotExchange
124 public:
125 static SotClipboardFormatId RegisterFormat( const css::datatransfer::DataFlavor& rFlavor );
126 static SotClipboardFormatId RegisterFormatName( const OUString& rName );
127 static SotClipboardFormatId RegisterFormatMimeType( const OUString& rMimeType );
129 static SotClipboardFormatId GetFormat( const css::datatransfer::DataFlavor& rFlavor );
130 static OUString GetFormatName( SotClipboardFormatId nFormat );
131 static bool GetFormatDataFlavor( SotClipboardFormatId nFormat, css::datatransfer::DataFlavor& rFlavor );
132 static OUString GetFormatMimeType( SotClipboardFormatId nFormat );
133 static bool IsInternal( const SvGlobalName& );
134 static SotClipboardFormatId GetFormatIdFromMimeType( const OUString& rMimeType );
136 // same for XTransferable interface
137 static sal_uInt8 GetExchangeAction(
138 // XTransferable
139 const DataFlavorExVector& rDataFlavorExVector,
140 // destination of an action
141 SotExchangeDest nDestination,
142 // action for a source
143 sal_uInt16 nSourceOptions,
144 // user action (EXCHG_IN_*, EXCHG_INOUT_*)
145 sal_uInt8 nUserAction,
146 // In:- Out: format to use
147 SotClipboardFormatId& rFormat,
148 // In:- Out: default action (EXCHG_IN_*, EXCHG_INOUT_*)
149 sal_uInt8& rDefaultAction,
150 // In:- optional - check only for this specific format
151 SotClipboardFormatId nOnlyTestFormat = SotClipboardFormatId::NONE,
152 // In:- optional - check the contents of Xtransferable
153 const css::uno::Reference< css::datatransfer::XTransferable >* pxTransferable = nullptr,
154 // Out: optional: - default action flags
155 SotExchangeActionFlags* pActionFlags = nullptr);
157 static sal_uInt16 IsChart( const SvGlobalName& rName );
158 static sal_uInt16 IsMath( const SvGlobalName& rName );
161 #endif
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */