Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SOT_EXCHANGE_HXX
21 : #define _SOT_EXCHANGE_HXX
22 :
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 <tools/solar.h>
30 :
31 : class SotDataObject;
32 :
33 : namespace com { namespace sun { namespace star { namespace datatransfer {
34 : class XTransferable;
35 : } } } }
36 :
37 : // ---------------------
38 : // - SotFormatStringId -
39 : // ---------------------
40 :
41 : typedef sal_uLong SotFormatStringId;
42 :
43 : // ----------------
44 : // - DataFlavorEx -
45 : // ----------------
46 :
47 0 : struct DataFlavorEx : public ::com::sun::star::datatransfer::DataFlavor
48 : {
49 : SotFormatStringId mnSotId;
50 : };
51 :
52 : typedef ::std::vector< ::com::sun::star::datatransfer::DataFlavor > DataFlavorVector;
53 : typedef ::std::vector< DataFlavorEx > _DataFlavorExVector;
54 :
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 9706 : struct DataFlavorExVector : public _DataFlavorExVector
59 : {
60 : };
61 :
62 : typedef ::std::list< ::com::sun::star::datatransfer::DataFlavor > DataFlavorList;
63 : typedef ::std::list< DataFlavorEx > DataFlavorExList;
64 :
65 : SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector,
66 : sal_uLong nId );
67 :
68 : // -------------------------
69 : // - Vordefinierte Formate -
70 : // -------------------------
71 :
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
79 : #define FORMAT_FILE 5
80 : #define FORMAT_FILE_LIST 6
81 :
82 : // Weitere Standardformate (diese gehen nur ueber CopyData/PasteData)
83 : #define FORMAT_RTF 10
84 :
85 : // Source-Options
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)
93 :
94 : // Aktionen
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)
143 :
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)
150 :
151 : // Ziele
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
169 :
170 : // ------------
171 : // - Exchange -
172 : // ------------
173 : class SvGlobalName;
174 : class SOT_DLLPUBLIC SotExchange
175 : {
176 : public:
177 : static sal_uLong RegisterFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
178 : static sal_uLong RegisterFormatName( const OUString& rName );
179 : static sal_uLong RegisterFormatMimeType( const OUString& rMimeType );
180 :
181 : static sal_uLong GetFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
182 : static OUString GetFormatName( sal_uLong nFormat );
183 : static bool GetFormatDataFlavor( sal_uLong nFormat, ::com::sun::star::datatransfer::DataFlavor& rFlavor );
184 : static OUString GetFormatMimeType( sal_uLong nFormat );
185 : static bool IsInternal( const SvGlobalName& );
186 : static sal_uLong GetFormatIdFromMimeType( const OUString& rMimeType );
187 :
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 )
193 : { return nFormat; }
194 49 : static SotFormatStringId GetFormatStringId( const OUString& rName )
195 49 : { return SotExchange::RegisterFormatMimeType( rName ); }
196 : static sal_uLong RegisterSotFormatName( SotFormatStringId nId )
197 : { return nId; }
198 :
199 : // same for XTransferable interface
200 : static sal_uInt16 GetExchangeAction(
201 : // XTransferable
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
210 : sal_uLong& rFormat,
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 );
217 :
218 : static sal_uInt16 IsChart( const SvGlobalName& rName );
219 : static sal_uInt16 IsMath( const SvGlobalName& rName );
220 : };
221 :
222 : #endif // _EXCHANGE_HXX
223 :
224 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|