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_SOT_EXCHANGE_HXX
21 #define INCLUDED_SOT_EXCHANGE_HXX
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>
35 namespace com
{ namespace sun
{ namespace star
{ namespace datatransfer
{
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
);
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
{
88 InsertImageMap
= 0x0400,
89 ReplaceImageMap
= 0x0800,
91 InsertTargetUrl
= 0x2000,
94 template<> struct typed_flags
<SotExchangeActionFlags
> : is_typed_flags
<SotExchangeActionFlags
, 0x3e00> {};
98 enum class SotExchangeDest
105 DOC_LNKD_GRAPHOBJ
= 5,
106 DOC_GRAPH_W_IMAP
= 6,
107 DOC_LNKD_GRAPH_W_IMAP
= 7,
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,
122 class SOT_DLLPUBLIC SotExchange
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(
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
);
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */