Branch libreoffice-5-0-4
[LibreOffice.git] / include / sot / exchange.hxx
blobbe53ba12ddd5f22f7de51cc26c45c34d5f0bef70
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>
32 class SotDataObject;
34 namespace com { namespace sun { namespace star { namespace datatransfer {
35 class XTransferable;
36 } } } }
39 struct DataFlavorEx : public ::com::sun::star::datatransfer::DataFlavor
41 SotClipboardFormatId mnSotId;
44 typedef ::std::vector< DataFlavorEx > _DataFlavorExVector;
46 // JP 23.03.2001 - this struct is only for "hide" the STD of the vetor,
47 // because our makefile filter all this symbols and so nowbody can use
48 // these struct in any interfacses.
49 struct DataFlavorExVector : public _DataFlavorExVector
54 SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector,
55 SotClipboardFormatId nId );
57 // actions
58 #define EXCHG_ACTION_MASK ((sal_uInt16)0x00FF)
59 #define EXCHG_INOUT_ACTION_NONE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_NONE)
60 #define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE
61 #define EXCHG_IN_ACTION_MOVE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_MOVE)
62 #define EXCHG_IN_ACTION_COPY ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY)
63 #define EXCHG_IN_ACTION_LINK ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_LINK)
64 #define EXCHG_OUT_ACTION_INSERT_OBJ ((sal_uInt16)17)
65 #define EXCHG_OUT_ACTION_INSERT_BOOKMARK ((sal_uInt16)18)
66 #define EXCHG_OUT_ACTION_INSERT_FILE ((sal_uInt16)20)
67 #define EXCHG_OUT_ACTION_INSERT_IMAGEMAP ((sal_uInt16)22)
68 #define EXCHG_OUT_ACTION_INSERT_OLE ((sal_uInt16)23)
69 #define EXCHG_OUT_ACTION_INSERT_INTERACTIVE ((sal_uInt16)24)
70 #define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP ((sal_uInt16)29)
71 #define EXCHG_OUT_ACTION_GET_ATTRIBUTES ((sal_uInt16)30)
72 #define EXCHG_OUT_ACTION_MOVE_FILE ((sal_uInt16)32)
73 #define EXCHG_OUT_ACTION_MOVE_FILELIST ((sal_uInt16)33)
74 #define EXCHG_OUT_ACTION_UPDATE_RANGE ((sal_uInt16)34)
75 #define EXCHG_OUT_ACTION_INSERT_PRIVATE ((sal_uInt16)35)
76 #define EXCHG_OUT_ACTION_INSERT_HTML ((sal_uInt16)36)
77 #define EXCHG_OUT_ACTION_MOVE_PRIVATE ((sal_uInt16)37)
78 #define EXCHG_OUT_ACTION_INSERT_STRING ((sal_uInt16)38)
79 #define EXCHG_OUT_ACTION_INSERT_DRAWOBJ ((sal_uInt16)39)
80 #define EXCHG_OUT_ACTION_INSERT_SVXB ((sal_uInt16)40)
81 #define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE ((sal_uInt16)41)
82 #define EXCHG_OUT_ACTION_INSERT_BITMAP ((sal_uInt16)42)
83 #define EXCHG_OUT_ACTION_INSERT_DDE ((sal_uInt16)43)
84 #define EXCHG_OUT_ACTION_INSERT_HYPERLINK ((sal_uInt16)44)
85 #define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ ((sal_uInt16)45)
86 #define EXCHG_OUT_ACTION_REPLACE_SVXB ((sal_uInt16)46)
87 #define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE ((sal_uInt16)47)
88 #define EXCHG_OUT_ACTION_REPLACE_BITMAP ((sal_uInt16)48)
89 #define EXCHG_OUT_ACTION_REPLACE_GRAPH ((sal_uInt16)49)
90 #define EXCHG_OUT_ACTION_INSERT_GRAPH ((sal_uInt16)50)
92 #define EXCHG_OUT_ACTION_FLAG_CREATE_THEME ((sal_uInt16)0x0100)
93 #define EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE ((sal_uInt16)0x0200)
94 #define EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP ((sal_uInt16)0x0400)
95 #define EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP ((sal_uInt16)0x0800)
96 #define EXCHG_OUT_ACTION_FLAG_FILL ((sal_uInt16)0x1000)
97 #define EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL ((sal_uInt16)0x2000)
99 // destinations
100 enum class SotExchangeDest
102 NONE = 0,
103 DOC_OLEOBJ = 1,
104 CHARTDOC_OLEOBJ = 2,
105 DOC_TEXTFRAME = 3,
106 DOC_GRAPHOBJ = 4,
107 DOC_LNKD_GRAPHOBJ = 5,
108 DOC_GRAPH_W_IMAP = 6,
109 DOC_LNKD_GRAPH_W_IMAP = 7,
110 DOC_IMAPREGION = 8,
111 DOC_DRAWOBJ = 9,
112 DOC_URLBUTTON = 10,
113 DOC_URLFIELD = 11,
114 DOC_GROUPOBJ = 12,
115 SWDOC_FREE_AREA = 13,
116 SCDOC_FREE_AREA = 14,
117 SDDOC_FREE_AREA = 15,
118 DOC_TEXTFRAME_WEB = 16,
119 SWDOC_FREE_AREA_WEB = 17,
122 class SvGlobalName;
124 class SOT_DLLPUBLIC SotExchange
126 public:
127 static SotClipboardFormatId RegisterFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
128 static SotClipboardFormatId RegisterFormatName( const OUString& rName );
129 static SotClipboardFormatId RegisterFormatMimeType( const OUString& rMimeType );
131 static SotClipboardFormatId GetFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
132 static OUString GetFormatName( SotClipboardFormatId nFormat );
133 static bool GetFormatDataFlavor( SotClipboardFormatId nFormat, ::com::sun::star::datatransfer::DataFlavor& rFlavor );
134 static OUString GetFormatMimeType( SotClipboardFormatId nFormat );
135 static bool IsInternal( const SvGlobalName& );
136 static SotClipboardFormatId GetFormatIdFromMimeType( const OUString& rMimeType );
138 // same for XTransferable interface
139 static sal_uInt16 GetExchangeAction(
140 // XTransferable
141 const DataFlavorExVector& rDataFlavorExVector,
142 // destination of an action
143 SotExchangeDest nDestination,
144 // action for a source
145 sal_uInt16 nSourceOptions,
146 // user action (EXCHG_IN_*, EXCHG_INOUT_*)
147 sal_uInt16 nUserAction,
148 // In:- Out: format to use
149 SotClipboardFormatId& rFormat,
150 // In:- Out: default action (EXCHG_IN_*, EXCHG_INOUT_*)
151 sal_uInt16& rDefaultAction,
152 // In:- optional - check only for this specific format
153 SotClipboardFormatId nOnlyTestFormat = SotClipboardFormatId::NONE,
154 // In:- optional - check the contents of Xtransferable
155 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >* pxTransferable = NULL );
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: */