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 <tools/solar.h>
33 namespace com
{ namespace sun
{ namespace star
{ namespace datatransfer
{
37 typedef sal_uLong SotFormatStringId
;
39 struct DataFlavorEx
: public ::com::sun::star::datatransfer::DataFlavor
41 SotFormatStringId mnSotId
;
44 typedef ::std::vector
< ::com::sun::star::datatransfer::DataFlavor
> DataFlavorVector
;
45 typedef ::std::vector
< DataFlavorEx
> _DataFlavorExVector
;
47 // JP 23.03.2001 - this struct is only for "hide" the STD of the vetor,
48 // because our makefile filter all this symbols and so nowbody can use
49 // these struct in any interfacses.
50 struct DataFlavorExVector
: public _DataFlavorExVector
54 typedef ::std::list
< ::com::sun::star::datatransfer::DataFlavor
> DataFlavorList
;
55 typedef ::std::list
< DataFlavorEx
> DataFlavorExList
;
57 SOT_DLLPUBLIC
bool IsFormatSupported( const DataFlavorExVector
& rDataFlavorExVector
,
60 // - predefined formats -
61 // Do NOT change the order of these values as the implementation depends on them!
63 // stardard formats for that Copy/Paste methods exist
64 #define FORMAT_STRING 1
65 #define FORMAT_BITMAP 2
66 #define FORMAT_GDIMETAFILE 3
67 #define FORMAT_PRIVATE 4
69 #define FORMAT_FILE_LIST 6
71 // further formats (only via CopyData/PasteData)
75 #define EXCHG_SOURCE_MOVEABLE ((sal_uInt16)0x0001)
76 #define EXCHG_SOURCE_COPYABLE ((sal_uInt16)0x0002)
77 #define EXCHG_SOURCE_LINKABLE ((sal_uInt16)0x0004)
78 #define EXCHG_SOURCE_PRINTABLE ((sal_uInt16)0x0008)
79 #define EXCHG_SOURCE_DISCARDABLE ((sal_uInt16)0x0010)
80 #define EXCHG_SOURCE_ALL ((sal_uInt16)0x001F)
81 #define EXCHG_SOURCE_DEF_COPYABLE ((sal_uInt16)0x0020)
84 #define EXCHG_ACTION_MASK ((sal_uInt16)0x00FF)
85 #define EXCHG_INOUT_ACTION_NONE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_NONE)
86 #define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE
87 #define EXCHG_IN_ACTION_MOVE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_MOVE)
88 #define EXCHG_IN_ACTION_COPY ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY)
89 #define EXCHG_IN_ACTION_LINK ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_LINK)
90 #define EXCHG_OUT_ACTION_INSERT_OBJ ((sal_uInt16)17)
91 #define EXCHG_OUT_ACTION_INSERT_BOOKMARK ((sal_uInt16)18)
92 #define EXCHG_OUT_ACTION_INSERT_FILE ((sal_uInt16)20)
93 #define EXCHG_OUT_ACTION_INSERT_IMAGEMAP ((sal_uInt16)22)
94 #define EXCHG_OUT_ACTION_INSERT_OLE ((sal_uInt16)23)
95 #define EXCHG_OUT_ACTION_INSERT_INTERACTIVE ((sal_uInt16)24)
96 #define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP ((sal_uInt16)29)
97 #define EXCHG_OUT_ACTION_GET_ATTRIBUTES ((sal_uInt16)30)
98 #define EXCHG_OUT_ACTION_MOVE_FILE ((sal_uInt16)32)
99 #define EXCHG_OUT_ACTION_MOVE_FILELIST ((sal_uInt16)33)
100 #define EXCHG_OUT_ACTION_UPDATE_RANGE ((sal_uInt16)34)
101 #define EXCHG_OUT_ACTION_INSERT_PRIVATE ((sal_uInt16)35)
102 #define EXCHG_OUT_ACTION_INSERT_HTML ((sal_uInt16)36)
103 #define EXCHG_OUT_ACTION_MOVE_PRIVATE ((sal_uInt16)37)
104 #define EXCHG_OUT_ACTION_INSERT_STRING ((sal_uInt16)38)
105 #define EXCHG_OUT_ACTION_INSERT_DRAWOBJ ((sal_uInt16)39)
106 #define EXCHG_OUT_ACTION_INSERT_SVXB ((sal_uInt16)40)
107 #define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE ((sal_uInt16)41)
108 #define EXCHG_OUT_ACTION_INSERT_BITMAP ((sal_uInt16)42)
109 #define EXCHG_OUT_ACTION_INSERT_DDE ((sal_uInt16)43)
110 #define EXCHG_OUT_ACTION_INSERT_HYPERLINK ((sal_uInt16)44)
111 #define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ ((sal_uInt16)45)
112 #define EXCHG_OUT_ACTION_REPLACE_SVXB ((sal_uInt16)46)
113 #define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE ((sal_uInt16)47)
114 #define EXCHG_OUT_ACTION_REPLACE_BITMAP ((sal_uInt16)48)
115 #define EXCHG_OUT_ACTION_REPLACE_GRAPH ((sal_uInt16)49)
116 #define EXCHG_OUT_ACTION_INSERT_GRAPH ((sal_uInt16)50)
118 #define EXCHG_OUT_ACTION_FLAG_CREATE_THEME ((sal_uInt16)0x0100)
119 #define EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE ((sal_uInt16)0x0200)
120 #define EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP ((sal_uInt16)0x0400)
121 #define EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP ((sal_uInt16)0x0800)
122 #define EXCHG_OUT_ACTION_FLAG_FILL ((sal_uInt16)0x1000)
123 #define EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL ((sal_uInt16)0x2000)
126 #define EXCHG_DEST_DOC_OLEOBJ 1
127 #define EXCHG_DEST_CHARTDOC_OLEOBJ 2
128 #define EXCHG_DEST_DOC_TEXTFRAME 3
129 #define EXCHG_DEST_DOC_GRAPHOBJ 4
130 #define EXCHG_DEST_DOC_LNKD_GRAPHOBJ 5
131 #define EXCHG_DEST_DOC_GRAPH_W_IMAP 6
132 #define EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP 7
133 #define EXCHG_DEST_DOC_IMAPREGION 8
134 #define EXCHG_DEST_DOC_DRAWOBJ 9
135 #define EXCHG_DEST_DOC_URLBUTTON 10
136 #define EXCHG_DEST_DOC_URLFIELD 11
137 #define EXCHG_DEST_DOC_GROUPOBJ 12
138 #define EXCHG_DEST_SWDOC_FREE_AREA 13
139 #define EXCHG_DEST_SCDOC_FREE_AREA 14
140 #define EXCHG_DEST_SDDOC_FREE_AREA 15
141 #define EXCHG_DEST_DOC_TEXTFRAME_WEB 16
142 #define EXCHG_DEST_SWDOC_FREE_AREA_WEB 17
146 class SOT_DLLPUBLIC SotExchange
149 static sal_uLong
RegisterFormat( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
150 static sal_uLong
RegisterFormatName( const OUString
& rName
);
151 static sal_uLong
RegisterFormatMimeType( const OUString
& rMimeType
);
153 static sal_uLong
GetFormat( const ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
154 static OUString
GetFormatName( sal_uLong nFormat
);
155 static bool GetFormatDataFlavor( sal_uLong nFormat
, ::com::sun::star::datatransfer::DataFlavor
& rFlavor
);
156 static OUString
GetFormatMimeType( sal_uLong nFormat
);
157 static bool IsInternal( const SvGlobalName
& );
158 static sal_uLong
GetFormatIdFromMimeType( const OUString
& rMimeType
);
160 // determine the SotFormatStringId for the registered format
161 //FIXME JP 12.11.98: this three methods are obsolete as all ClipboardIds are static and equvialent to the SotFormatStringIds!
162 static SotFormatStringId
GetFormatStringId( sal_uLong nFormat
)
164 static SotFormatStringId
GetFormatStringId( const OUString
& rName
)
165 { return SotExchange::RegisterFormatMimeType( rName
); }
166 static sal_uLong
RegisterSotFormatName( SotFormatStringId nId
)
169 // same for XTransferable interface
170 static sal_uInt16
GetExchangeAction(
172 const DataFlavorExVector
& rDataFlavorExVector
,
173 // destination of an action (EXCHG_DEST_*)
174 sal_uInt16 nDestination
,
175 // action for a source (EXCHG_SOURCE_...)
176 sal_uInt16 nSourceOptions
,
177 // user action (EXCHG_IN_*, EXCHG_INOUT_*)
178 sal_uInt16 nUserAction
,
179 // In:- Out: format to use
181 // In:- Out: default action (EXCHG_IN_*, EXCHG_INOUT_*)
182 sal_uInt16
& rDefaultAction
,
183 // In:- optional - check only for this specific format
184 sal_uLong nOnlyTestFormat
= 0,
185 // In:- optional - check the contents of Xtransferable
186 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>* pxTransferable
= NULL
);
188 static sal_uInt16
IsChart( const SvGlobalName
& rName
);
189 static sal_uInt16
IsMath( const SvGlobalName
& rName
);
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */