tdf#148470 if macOS glyph fallback provided a partial result flag what failed
[LibreOffice.git] / include / sot / exchange.hxx
blobc7fed6d3b85111d213e5efa8387433b2925da060
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 <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>
28 #include <o3tl/typed_flags_set.hxx>
30 namespace com::sun::star::datatransfer {
31 class XTransferable;
34 namespace com::sun::star::uno { template <typename > class Reference; }
36 struct DataFlavorEx : public css::datatransfer::DataFlavor
38 SotClipboardFormatId mnSotId;
41 typedef ::std::vector<DataFlavorEx> DataFlavorExVector;
44 SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector,
45 SotClipboardFormatId nId );
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))
76 enum class SotExchangeActionFlags {
77 NONE = 0x0000,
78 InsertImageMap = 0x0400,
79 ReplaceImageMap = 0x0800,
80 InsertTargetUrl = 0x2000,
82 namespace o3tl {
83 template<> struct typed_flags<SotExchangeActionFlags> : is_typed_flags<SotExchangeActionFlags, 0x2c00> {};
86 // destinations
87 enum class SotExchangeDest
89 NONE = 0,
90 DOC_OLEOBJ = 1,
91 CHARTDOC_OLEOBJ = 2,
92 DOC_TEXTFRAME = 3,
93 DOC_GRAPHOBJ = 4,
94 DOC_LNKD_GRAPHOBJ = 5,
95 DOC_GRAPH_W_IMAP = 6,
96 DOC_LNKD_GRAPH_W_IMAP = 7,
97 DOC_IMAPREGION = 8,
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,
105 DOC_TEXTFRAME_WEB = 16,
106 SWDOC_FREE_AREA_WEB = 17,
109 class SvGlobalName;
111 class SOT_DLLPUBLIC SotExchange
113 public:
114 static SotClipboardFormatId RegisterFormat( const css::datatransfer::DataFlavor& rFlavor );
115 static SotClipboardFormatId RegisterFormatName( const OUString& rName );
116 static SotClipboardFormatId RegisterFormatMimeType( const OUString& rMimeType );
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( const OUString& rMimeType );
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
140 SotClipboardFormatId nOnlyTestFormat = SotClipboardFormatId::NONE,
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);
146 static sal_uInt16 IsChart( const SvGlobalName& rName );
147 static sal_uInt16 IsMath( const SvGlobalName& rName );
150 #endif
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */