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 _SOT_EXCHANGE_HXX
21 #define _SOT_EXCHANGE_HXX
25 #include <tools/string.hxx>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <com/sun/star/datatransfer/DataFlavor.hpp>
28 #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
29 #include "sot/sotdllapi.h"
33 namespace com
{ namespace sun
{ namespace star
{ namespace datatransfer
{
37 // ---------------------
38 // - SotFormatStringId -
39 // ---------------------
41 typedef sal_uLong SotFormatStringId
;
47 struct DataFlavorEx
: public ::com::sun::star::datatransfer::DataFlavor
49 SotFormatStringId mnSotId
;
52 typedef ::std::vector
< ::com::sun::star::datatransfer::DataFlavor
> DataFlavorVector
;
53 typedef ::std::vector
< DataFlavorEx
> _DataFlavorExVector
;
55 // JP 23.03.2001 - this struct is only for "hide" the STD of the vetor,
56 // because our makefile filter all this symbols and so nowbody can use
57 // these struct in any interfacses.
58 struct DataFlavorExVector
: public _DataFlavorExVector
62 typedef ::std::list
< ::com::sun::star::datatransfer::DataFlavor
> DataFlavorList
;
63 typedef ::std::list
< DataFlavorEx
> DataFlavorExList
;
65 SOT_DLLPUBLIC sal_Bool
IsFormatSupported( const DataFlavorExVector
& rDataFlavorExVector
,
68 // -------------------------
69 // - Vordefinierte Formate -
70 // -------------------------
72 // Die Reihenfolge und die Werte d�rfen nicht ge�ndert werden,
73 // da die Implementation sich darauf verl��t.
74 // Standard-Formate fuer die es auch Copy/Paste-Methoden gibt
75 #define FORMAT_STRING 1
76 #define FORMAT_BITMAP 2
77 #define FORMAT_GDIMETAFILE 3
78 #define FORMAT_PRIVATE 4
80 #define FORMAT_FILE_LIST 6
82 // Weitere Standardformate (diese gehen nur ueber CopyData/PasteData)
86 #define EXCHG_SOURCE_MOVEABLE ((sal_uInt16)0x0001)
87 #define EXCHG_SOURCE_COPYABLE ((sal_uInt16)0x0002)
88 #define EXCHG_SOURCE_LINKABLE ((sal_uInt16)0x0004)
89 #define EXCHG_SOURCE_PRINTABLE ((sal_uInt16)0x0008)
90 #define EXCHG_SOURCE_DISCARDABLE ((sal_uInt16)0x0010)
91 #define EXCHG_SOURCE_ALL ((sal_uInt16)0x001F)
92 #define EXCHG_SOURCE_DEF_COPYABLE ((sal_uInt16)0x0020)
95 #define EXCHG_ACTION_MASK ((sal_uInt16)0x00FF)
96 #define EXCHG_INOUT_ACTION_NONE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_NONE)
97 #define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE
98 #define EXCHG_IN_ACTION_MOVE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_MOVE)
99 #define EXCHG_IN_ACTION_COPY ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY)
100 #define EXCHG_IN_ACTION_LINK ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_LINK)
101 #define EXCHG_INOUT_ACTION_PRINT ((sal_uInt16)8)
102 #define EXCHG_INOUT_ACTION_DISCARD ((sal_uInt16)16)
103 #define EXCHG_OUT_ACTION_INSERT_OBJ ((sal_uInt16)17)
104 #define EXCHG_OUT_ACTION_INSERT_BOOKMARK ((sal_uInt16)18)
105 #define EXCHG_OUT_ACTION_INSERT_FILELINK ((sal_uInt16)19)
106 #define EXCHG_OUT_ACTION_INSERT_FILE ((sal_uInt16)20)
107 #define EXCHG_OUT_ACTION_INSERT_FILELIST ((sal_uInt16)21)
108 #define EXCHG_OUT_ACTION_INSERT_IMAGEMAP ((sal_uInt16)22)
109 #define EXCHG_OUT_ACTION_INSERT_OLE ((sal_uInt16)23)
110 #define EXCHG_OUT_ACTION_INSERT_INTERACTIVE ((sal_uInt16)24)
111 #define EXCHG_OUT_ACTION_INSERT_URLBUTTON ((sal_uInt16)25)
112 #define EXCHG_OUT_ACTION_INSERT_CHAOSOBJ ((sal_uInt16)26) // OBSOLET ab 500.b ?
113 #define EXCHG_OUT_ACTION_REPLACE_OBJ ((sal_uInt16)27)
114 #define EXCHG_OUT_ACTION_REPLACE_LINK ((sal_uInt16)28)
115 #define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP ((sal_uInt16)29)
116 #define EXCHG_OUT_ACTION_GET_ATTRIBUTES ((sal_uInt16)30)
117 #define EXCHG_OUT_ACTION_UPLOAD ((sal_uInt16)31) // OBSOLET ab 500.b ?
118 #define EXCHG_OUT_ACTION_MOVE_FILE ((sal_uInt16)32)
119 #define EXCHG_OUT_ACTION_MOVE_FILELIST ((sal_uInt16)33)
120 #define EXCHG_OUT_ACTION_UPDATE_RANGE ((sal_uInt16)34)
121 #define EXCHG_OUT_ACTION_INSERT_PRIVATE ((sal_uInt16)35)
122 #define EXCHG_OUT_ACTION_INSERT_HTML ((sal_uInt16)36)
123 #define EXCHG_OUT_ACTION_MOVE_PRIVATE ((sal_uInt16)37)
124 #define EXCHG_OUT_ACTION_INSERT_STRING ((sal_uInt16)38)
125 #define EXCHG_OUT_ACTION_INSERT_DRAWOBJ ((sal_uInt16)39)
126 #define EXCHG_OUT_ACTION_INSERT_SVXB ((sal_uInt16)40)
127 #define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE ((sal_uInt16)41)
128 #define EXCHG_OUT_ACTION_INSERT_BITMAP ((sal_uInt16)42)
129 #define EXCHG_OUT_ACTION_INSERT_DDE ((sal_uInt16)43)
130 #define EXCHG_OUT_ACTION_INSERT_HYPERLINK ((sal_uInt16)44)
131 #define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ ((sal_uInt16)45)
132 #define EXCHG_OUT_ACTION_REPLACE_SVXB ((sal_uInt16)46)
133 #define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE ((sal_uInt16)47)
134 #define EXCHG_OUT_ACTION_REPLACE_BITMAP ((sal_uInt16)48)
135 #define EXCHG_OUT_ACTION_REPLACE_GRAPH ((sal_uInt16)49)
136 #define EXCHG_OUT_ACTION_INSERT_GRAPH ((sal_uInt16)50)
137 #define EXCHG_OUT_ACTION_INSERT_MSGATTACH ((sal_uInt16)51) // obsolet ab 500.b ?
138 #define EXCHG_OUT_ACTION_COPY_CHAOSOBJ ((sal_uInt16)52)
139 #define EXCHG_OUT_ACTION_MOVE_CHAOSOBJ ((sal_uInt16)53)
140 #define EXCHG_OUT_ACTION_COPY_MSGATTACH ((sal_uInt16)54)
141 #define EXCHG_OUT_ACTION_COPY_BOOKMARK ((sal_uInt16)55)
142 #define EXCHG_OUT_ACTION_COPY_FILE ((sal_uInt16)56)
144 #define EXCHG_OUT_ACTION_FLAG_CREATE_THEME ((sal_uInt16)0x0100)
145 #define EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE ((sal_uInt16)0x0200)
146 #define EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP ((sal_uInt16)0x0400)
147 #define EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP ((sal_uInt16)0x0800)
148 #define EXCHG_OUT_ACTION_FLAG_FILL ((sal_uInt16)0x1000)
149 #define EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL ((sal_uInt16)0x2000)
152 #define EXCHG_DEST_DOC_OLEOBJ 1
153 #define EXCHG_DEST_CHARTDOC_OLEOBJ 2
154 #define EXCHG_DEST_DOC_TEXTFRAME 3
155 #define EXCHG_DEST_DOC_GRAPHOBJ 4
156 #define EXCHG_DEST_DOC_LNKD_GRAPHOBJ 5
157 #define EXCHG_DEST_DOC_GRAPH_W_IMAP 6
158 #define EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP 7
159 #define EXCHG_DEST_DOC_IMAPREGION 8
160 #define EXCHG_DEST_DOC_DRAWOBJ 9
161 #define EXCHG_DEST_DOC_URLBUTTON 10
162 #define EXCHG_DEST_DOC_URLFIELD 11
163 #define EXCHG_DEST_DOC_GROUPOBJ 12
164 #define EXCHG_DEST_SWDOC_FREE_AREA 13
165 #define EXCHG_DEST_SCDOC_FREE_AREA 14
166 #define EXCHG_DEST_SDDOC_FREE_AREA 15
167 #define EXCHG_DEST_DOC_TEXTFRAME_WEB 16
168 #define EXCHG_DEST_SWDOC_FREE_AREA_WEB 17
174 class SOT_DLLPUBLIC SotExchange
177 static sal_uLong
RegisterFormat( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
178 static sal_uLong
RegisterFormatName( const String
& rName
);
179 static sal_uLong
RegisterFormatMimeType( const String
& rMimeType
);
181 static sal_uLong
GetFormat( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
182 static String
GetFormatName( sal_uLong nFormat
);
183 static sal_Bool
GetFormatDataFlavor( sal_uLong nFormat
, ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
184 static String
GetFormatMimeType( sal_uLong nFormat
);
185 static sal_Bool
IsInternal( const SvGlobalName
& );
186 static sal_uLong
GetFormatIdFromMimeType( const String
& rMimeType
);
188 // bestimme die SotFormatStringId von dem registrierten Format
189 //JP 12.11.98: diese 3 Methoden sind ab sofort ueberfluessig, da
190 // die ClipboardIds statisch sind und aequivalent zur
191 // SotFormatStringId ist!
192 static SotFormatStringId
GetFormatStringId( sal_uLong nFormat
)
194 static SotFormatStringId
GetFormatStringId( const String
& rName
)
195 { return SotExchange::RegisterFormatMimeType( rName
); }
196 static sal_uLong
RegisterSotFormatName( SotFormatStringId nId
)
199 // same for XTransferable interface
200 static sal_uInt16
GetExchangeAction(
202 const DataFlavorExVector
& rDataFlavorExVector
,
203 // Ziel der Aktion (EXCHG_DEST_*)
204 sal_uInt16 nDestination
,
205 // Aktionen, die Quelle unterstuetzt (EXCHG_SOURCE_...)
206 sal_uInt16 nSourceOptions
,
207 // vom Anwender gewaehlte Aktion (EXCHG_IN_*, EXCHG_INOUT_*)
208 sal_uInt16 nUserAction
,
209 // In:- Out: Zu benutzendes Format
211 // In:- Out: Default-Action (EXCHG_IN_*, EXCHG_INOUT_*)
212 sal_uInt16
& rDefaultAction
,
213 // In:- optional - check only for this specific format
214 sal_uLong nOnlyTestFormat
= 0,
215 // In:- optional - check the contents of Xtransferable
216 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>* pxTransferable
= NULL
);
218 static sal_uInt16
IsChart( const SvGlobalName
& rName
);
219 static sal_uInt16
IsMath( const SvGlobalName
& rName
);
222 #endif // _EXCHANGE_HXX
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */